git://boxin.space
/
bare
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
34aa3e3
)
Support enums
main
author
Mira Ayre
<mi@boxin.space>
Tue, 7 Jul 2020 20:25:31 +0000
(21:25 +0100)
committer
Mira Ayre
<mi@boxin.space>
Fri, 9 Jul 2021 19:18:39 +0000
(20:18 +0100)
bare.d
patch
|
blob
|
history
diff --git
a/bare.d
b/bare.d
index 054e90ee49af3db533cd4a1d39e5b9da15086661..36f0f0aee5c0db1fcd7def69f9d21ce339087720 100644
(file)
--- a/
bare.d
+++ b/
bare.d
@@
-76,7
+76,12
@@
ubyte[] writeb( string v ) { return wruint( v.length ) ~ cast(ubyte[])v ; }
void readb(T)( ref ubyte[] data ) if ( is( T == void ) ) { return ; }
// no write as it is useless
-// NOTE: use *uint methods for enums
+T readb(T)( ref ubyte[] data ) if ( is( T == enum ) ) {
+ return cast(T)data.rduint ;
+}
+ubyte[] writeb(T)( T v ) if ( is( T == enum ) ) {
+ return wruint( cast(ulong)v ) ;
+}
// NOTE: data and data<length> use array aggregate methods