Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not 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

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