Implement core function to reinterpreting anything as bytes
This commit is contained in:
parent
2cbd8d1f31
commit
a67d7239a4
|
@ -461,6 +461,13 @@ export namespace coral {
|
|||
|
||||
// Input/output operations.
|
||||
export namespace coral {
|
||||
/**
|
||||
* Returns `value` reinterpreted as a sequence of bytes.
|
||||
*/
|
||||
slice<u8 const> as_bytes(auto & value) {
|
||||
return {reinterpret_cast<u8 const *>(&value), sizeof(value)};
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares `a` and `b`, returning the difference between them or `0` if they are identical.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue