@ -2,6 +2,6 @@
#include "uint16.h"
void uint16_pack(char *out,uint16 in) {
out[0]=in&255;
out[0]=(char)in;
out[1]=in>>8;
out[1]=(char)(in>>8);
}
void uint16_pack_big(char *out,uint16 in) {
out[0]=in>>8;
out[0]=(char)(in>>8);
out[1]=in&255;
out[1]=(char)in;
@ -2,5 +2,5 @@
uint16 uint16_read(const char *in) {
return ((unsigned short)((unsigned char) in[1]) << 8) + (unsigned char)in[0];
return (unsigned short)((((unsigned char) in[1]) << 8) | (unsigned char)in[0]);
uint16 uint16_read_big(const char *in) {
return ((unsigned short)((unsigned char) in[0]) << 8) + (unsigned char)in[1];
return (unsigned short)((((unsigned char) in[0]) << 8) + (unsigned char)in[1]);
void uint16_unpack(const char *in,uint16 *out) {
*out = ((unsigned short)((unsigned char) in[1]) << 8) + (unsigned char)in[0];
*out = (unsigned short)((((unsigned char) in[1]) << 8) + (unsigned char)in[0]);
void uint16_unpack_big(const char *in,uint16 *out) {
*out = ((unsigned short)((unsigned char) in[0]) << 8) + (unsigned char)in[1];
*out = (unsigned short)((((unsigned char) in[0]) << 8) + (unsigned char)in[1]);
@ -2,8 +2,8 @@
#include "uint32.h"
void uint32_pack(char *out,uint32 in) {
*out=in&0xff; in>>=8;
*out=(char)in; in>>=8;
*++out=in&0xff; in>>=8;
*++out=(char)in; in>>=8;
*++out=in&0xff;
*++out=(char)in;
void uint32_pack_big(char *out,uint32 in) {
out[3]=in&0xff; in>>=8;
out[3]=(char)in; in>>=8;
out[2]=in&0xff; in>>=8;
out[2]=(char)in; in>>=8;
out[1]=in&0xff; in>>=8;
out[1]=(char)in; in>>=8;
out[0]=in&0xff;
@ -4,5 +4,5 @@
void uint64_pack(char *out,uint64 in) {
uint32_pack(out,in&0xffffffff);
uint32_pack(out+4,in>>32);
uint32_pack(out+4,(uint32)(in>>32));
@ -3,6 +3,6 @@
void uint64_pack_big(char *out,uint64 in) {
uint32_pack_big(out,in>>32);
uint32_pack_big(out,(uint32)(in>>32));
uint32_pack_big(out+4,in&0xffffffff);