| .. | .. | 
|---|
| 38 | 38 | */ | 
|---|
| 39 | 39 | #define find_closest_descending(x, a, as) __find_closest(x, a, as, >=) | 
|---|
| 40 | 40 |  | 
|---|
|  | 41 | +/** | 
|---|
|  | 42 | + * is_insidevar - check if the @ptr points inside the @var memory range. | 
|---|
|  | 43 | + * @ptr:	the pointer to a memory address. | 
|---|
|  | 44 | + * @var:	the variable which address and size identify the memory range. | 
|---|
|  | 45 | + * | 
|---|
|  | 46 | + * Evaluates to true if the address in @ptr lies within the memory | 
|---|
|  | 47 | + * range allocated to @var. | 
|---|
|  | 48 | + */ | 
|---|
|  | 49 | +#define is_insidevar(ptr, var)						\ | 
|---|
|  | 50 | +	((uintptr_t)(ptr) >= (uintptr_t)(var) &&			\ | 
|---|
|  | 51 | +	 (uintptr_t)(ptr) <  (uintptr_t)(var) + sizeof(var)) | 
|---|
|  | 52 | + | 
|---|
| 41 | 53 | #endif | 
|---|