bo.c (810B)
1 #include "u.h" 2 #include "lib.h" 3 #include "ip.h" 4 5 void 6 hnputv(void *p, uvlong v) 7 { 8 uchar *a; 9 10 a = p; 11 a[0] = v>>56; 12 a[1] = v>>48; 13 a[2] = v>>40; 14 a[3] = v>>32; 15 a[4] = v>>24; 16 a[5] = v>>16; 17 a[6] = v>>8; 18 a[7] = v; 19 } 20 21 void 22 hnputl(void *p, uint v) 23 { 24 uchar *a; 25 26 a = p; 27 a[0] = v>>24; 28 a[1] = v>>16; 29 a[2] = v>>8; 30 a[3] = v; 31 } 32 33 void 34 hnputs(void *p, ushort v) 35 { 36 uchar *a; 37 38 a = p; 39 a[0] = v>>8; 40 a[1] = v; 41 } 42 43 uvlong 44 nhgetv(void *p) 45 { 46 uchar *a; 47 uvlong v; 48 49 a = p; 50 v = (uvlong)a[0]<<56; 51 v |= (uvlong)a[1]<<48; 52 v |= (uvlong)a[2]<<40; 53 v |= (uvlong)a[3]<<32; 54 v |= a[4]<<24; 55 v |= a[5]<<16; 56 v |= a[6]<<8; 57 v |= a[7]<<0; 58 return v; 59 } 60 61 uint 62 nhgetl(void *p) 63 { 64 uchar *a; 65 66 a = p; 67 return (a[0]<<24)|(a[1]<<16)|(a[2]<<8)|(a[3]<<0); 68 } 69 70 ushort 71 nhgets(void *p) 72 { 73 uchar *a; 74 75 a = p; 76 return (a[0]<<8)|(a[1]<<0); 77 }