Add hulk.range

This commit is contained in:
Josh Holtrop 2023-06-10 22:13:20 -04:00
parent 2935903bae
commit c16aa0e9c3

27
src/hulk/range.d Normal file
View 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;
}
}