47 printf(
"bencode_2: got %04X,", i );
51 printf(
"coded %04X\n", i );
120 printf(
"buf pos = %d\n", pB->
pos );
121 printf(
"decoding string length...\n" );
125 printf(
"string len %d\n", len );
129 if( *ps ==
NULL ) *ps = (
char*)
zalloc( len+1 );
130 strncpy( *ps, &pB->
buf[pB->
pos], len );
134 printf(
"string:\"%s\"\n", *ps );
148 strncpy( &pB->
buf[pB->
pos], *ps, len );
156#ifdef MUD_LITTLE_ENDIAN
160 unsigned int exp : 8;
161 unsigned int sign : 1;
165 unsigned int exp : 8;
166 unsigned int sign : 1;
171 struct ieee_single
ieee;
173 {{ 0x7f, 0xff, 0x0, 0xffff },
174 { 0x0, 0x0, 0xff, 0x0 }},
175 {{ 0x0, 0x0, 0x0, 0x0 },
176 { 0x0, 0x0, 0x0, 0x0 }}
195 {{ 0xffff, 0x0, 0xff, 0x7f },
196 { 0x0, 0xff, 0x0, 0x0 }},
197 {{ 0x0, 0x0, 0x0, 0x0 },
198 { 0x0, 0x0, 0x0, 0x0 }}
202#define VAX_SNG_BIAS 0x81
203#define IEEE_SNG_BIAS 0x7f
267 printf(
"man1:%d man2:%d exp:%d sign:%d\n",
306#ifdef MUD_LITTLE_ENDIAN
312 unsigned int exp : 11;
313 unsigned int sign : 1;
317 unsigned int exp : 8;
318 unsigned int sign : 1;
325 struct ieee_double
ieee;
327 {{ 0x7f, 0xff, 0x0, 0xffff, 0xffff, 0xffff },
328 { 0x0, 0x0, 0x0, 0x0, 0x7ff, 0x0 }},
329 {{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
330 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }}
353 {{ 0xffff, 0xffff, 0xffff, 0x0, 0xff, 0x7f },
354 { 0x0, 0x7ff, 0x0, 0x0, 0x0, 0x0 }},
355 {{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
356 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }}
360#define VAX_DBL_BIAS 0x81
361#define IEEE_DBL_BIAS 0x3ff
362#define MASK(nbits) ((1 << nbits) - 1)
396 vd.
mantissa1 = (
id.mantissa1 << 3 ) | (
id.mantissa2 >> 13);
397 vd.
mantissa2 = (
id.mantissa2 << 3) | (
id.mantissa3 >> 13);
398 vd.
mantissa3 = (
id.mantissa3 << 3) | (
id.mantissa4 >> 13);
void encode_str(BUF *pB, char **ps)
void bdecode_float(char *buf, float *fp)
void bdecode_double(char *buf, double *dp)
void encode_float(BUF *pBuf, float *fp)
void bencode_4(void *b, void *p)
void bdecode_4(void *b, void *p)
void bdecode_8(void *b, void *p)
void bencode_float(char *buf, float *fp)
void encode_double(BUF *pBuf, double *fp)
void bencode_2(void *b, void *p)
void decode_double(BUF *pBuf, double *fp)
void bdecode_2(void *b, void *p)
void bencode_8(void *b, void *p)
void decode_str(BUF *pB, char **ps)
void decode_float(BUF *pBuf, float *fp)
void bencode_double(char *buf, double *dp)