OSDN Git Service

(none)
[hos/hos-v4a.git] / aplfw / library / container / fixmemheap / fixmemheap_ismember.c
1 /** 
2  *  Hyper Operating System  Application Framework
3  *
4  * @file  fixmemheap_ismember.c
5  * @brief %jp{固定サイズメモリヒープクラス}%en{fixed size memory heap class}
6  *
7  * Copyright (C) 2006-2008 by Project HOS
8  * http://sourceforge.jp/projects/hos/
9  */
10
11
12 #include <stdio.h>
13 #include "fixmemheap_local.h"
14
15
16 /** メモリがヒープに属しているかチェック */
17 int FixMemHeap_IsMember(void *pMemHeap, void *pMem)
18 {
19         C_FIXMEMHEAP            *self;
20
21         /* upper cast */
22         self = (C_FIXMEMHEAP *)pMemHeap;
23         
24         /* %jp{ポインタ範囲チェック} */
25         if ( pMem < (void *)self->pMemBase || pMem >= (void *)((char *)self->pMemBase + (self->BlkSize * self->BlkNum)) )
26         {
27                 return 0;
28         }
29         
30         return 1;
31 }
32
33
34 /* end of file */