Add hulk.range
This commit is contained in:
parent
2935903bae
commit
c16aa0e9c3
27
src/hulk/range.d
Normal file
27
src/hulk/range.d
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
module hulk.range;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representation of a memory range.
|
||||||
|
*/
|
||||||
|
struct Range
|
||||||
|
{
|
||||||
|
/** Range base address. */
|
||||||
|
void * _address;
|
||||||
|
|
||||||
|
/** Range length. */
|
||||||
|
size_t length;
|
||||||
|
|
||||||
|
/** Set the range address. */
|
||||||
|
@property void * address(T)(T a)
|
||||||
|
{
|
||||||
|
static assert(T.sizeof == size_t.sizeof);
|
||||||
|
_address = cast(void *)a;
|
||||||
|
return _address;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get the range address. */
|
||||||
|
@property void * address()
|
||||||
|
{
|
||||||
|
return _address;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user