You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
903 B
C

24 years ago
#ifndef UINT16_H
#define UINT16_H
#include <sys/cdefs.h>
typedef unsigned short uint16;
#ifndef __linux__
#define NO_UINT16_MACROS
#endif
24 years ago
#ifdef NO_UINT16_MACROS
24 years ago
extern void uint16_pack(char *out,uint16 in);
extern void uint16_pack_big(char *out,uint16 in);
extern void uint16_unpack(const char *in,uint16* out);
extern void uint16_unpack_big(const char *in,uint16* out);
24 years ago
#else
#include <endian.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define uint16_pack(out,in) (*(short*)(out)=(in))
24 years ago
extern void uint16_pack_big(char *out,uint16 in);
24 years ago
#define uint16_unpack(in,out) (*(out)=*(short*)(in))
24 years ago
extern void uint16_unpack_big(const char *in,uint16* out);
24 years ago
#else
24 years ago
extern void uint16_pack(char *out,uint16 in);
24 years ago
#define uint16_pack_big(out,in) (*(short*)(out)=(in))
24 years ago
extern void uint16_unpack(const char *in,uint16* out);
24 years ago
#define uint16_unpack_big(in,out) (*(out)=*(short*)(in))
#endif
#endif
#endif