version 1.2, 2008/02/19 00:28:13
|
version 1.3, 2016/11/22 14:47:52
|
Line 3
|
Line 3
|
|
|
#include <endian.h> |
#include <endian.h> |
|
|
|
/* STRALIGN returns the number of bytes to add to a pointer to make it |
|
* point to a (unsigned long)-aligned piece of memory */ |
|
#define STRALIGN(x) ((((uintptr_t)x+sizeof(long)-1)&(-sizeof(long)))-(uintptr_t)x) |
|
|
|
/* MKW returns an unsigned long vector where every byte is x */ |
|
#define MKW(x) ((unsigned long)x*0x0101010101010101) |
|
|
|
/* |
#if __WORDSIZE == 64 |
#if __WORDSIZE == 64 |
# define MKW(x) (x|x<<8|x<<16|x<<24|x<<32|x<<40|x<<48|x<<56) |
# define MKW(x) (x|x<<8|x<<16|x<<24|x<<32|x<<40|x<<48|x<<56) |
# define STRALIGN(x) (((unsigned long)x&7)?8-((unsigned long)x&7):0) |
# define STRALIGN(x) (((unsigned long)x&7)?8-((unsigned long)x&7):0) |
#else /* __WORDSIZE == 32 */ |
#else |
# define MKW(x) (x|x<<8|x<<16|x<<24) |
# define MKW(x) (x|x<<8|x<<16|x<<24) |
# define STRALIGN(x) (((unsigned long)x&3)?4-((unsigned long)x&3):0) |
# define STRALIGN(x) (((unsigned long)x&3)?4-((unsigned long)x&3):0) |
#endif |
#endif |
|
*/ |
|
|
/* GFC(x) - returns first character */ |
/* GFC(x) - returns first character */ |
/* INCSTR(x) - moves to next character */ |
/* INCSTR(x) - moves to next character */ |