diff options
| author | rsc <devnull@localhost> | 2003-11-23 18:19:58 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2003-11-23 18:19:58 +0000 |
| commit | 056fe1ba7fa0b70f871dfb9005b24eb8e4cc230b (patch) | |
| tree | 9ad42f31c3bc124cf6617cf9eb41dd525eccce83 /src/libventi/cvt.h | |
| parent | 9df487d720a59bf8cb0dc4ccffc30ad8eb48256a (diff) | |
| download | plan9port-056fe1ba7fa0b70f871dfb9005b24eb8e4cc230b.tar.gz plan9port-056fe1ba7fa0b70f871dfb9005b24eb8e4cc230b.zip | |
new venti library.
Diffstat (limited to 'src/libventi/cvt.h')
| -rw-r--r-- | src/libventi/cvt.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libventi/cvt.h b/src/libventi/cvt.h new file mode 100644 index 00000000..ef4c2f51 --- /dev/null +++ b/src/libventi/cvt.h @@ -0,0 +1,15 @@ +/* + * integer conversion routines + */ +#define U8GET(p) ((p)[0]) +#define U16GET(p) (((p)[0]<<8)|(p)[1]) +#define U32GET(p) ((u32int)(((p)[0]<<24)|((p)[1]<<16)|((p)[2]<<8)|(p)[3])) +#define U48GET(p) (((vlong)U16GET(p)<<32)|(vlong)U32GET((p)+2)) +#define U64GET(p) (((vlong)U32GET(p)<<32)|(vlong)U32GET((p)+4)) + +#define U8PUT(p,v) (p)[0]=(v) +#define U16PUT(p,v) (p)[0]=(v)>>8;(p)[1]=(v) +#define U32PUT(p,v) (p)[0]=(v)>>24;(p)[1]=(v)>>16;(p)[2]=(v)>>8;(p)[3]=(v) +#define U48PUT(p,v,t32) t32=(v)>>32;U16PUT(p,t32);t32=(v);U32PUT((p)+2,t32) +#define U64PUT(p,v,t32) t32=(v)>>32;U32PUT(p,t32);t32=(v);U32PUT((p)+4,t32) + |
