Select Git revision
Forked from
Nettle / nettle
Source project has a limited visibility.
-
Niels Möller authored
non-static. Use the READ_UINT32 and WRITE_UINT32 macros from lsh_types.h. Rev: src/symmetric/include/sha.h:1.4 Rev: src/symmetric/sha.c:1.5
Niels Möller authorednon-static. Use the READ_UINT32 and WRITE_UINT32 macros from lsh_types.h. Rev: src/symmetric/include/sha.h:1.4 Rev: src/symmetric/sha.c:1.5
pike_macros.h 1.68 KiB
/*\
||| This file a part of Pike, and is copyright by Fredrik Hubinette
||| Pike is distributed as GPL (General Public License)
||| See the files COPYING and DISCLAIMER for more information.
\*/
/*
* $Id: pike_macros.h,v 1.12 1999/02/10 21:46:47 hubbe Exp $
*/
#ifndef MACROS_H
#define MACROS_H
#include <global.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include "pike_memory.h"
#define OFFSETOF(str_type, field) ((long)& (((struct str_type *)0)->field))
#define BASEOF(ptr, str_type, field) \
((struct str_type *)((char*)ptr - (char*)& (((struct str_type *)0)->field)))
#define NELEM(a) (sizeof (a) / sizeof ((a)[0]))
#define ALLOC_STRUCT(X) ( (struct X *)xalloc(sizeof(struct X)) )
#define MINIMUM(X,Y) ((X)<(Y)?(X):(Y))
#define MAXIMUM(X,Y) ((X)>(Y)?(X):(Y))
#define is8bitalnum(X) ("0000000000000000" \
"0000000000000000" \
"0000000000000000" \
"1111111111000000" \
"0111111111111111" \
"1111111111100001" \
"0111111111111111" \
"1111111111100000" \
"0000000000000000" \
"0000000000000000" \
"1011110101100010" \
"1011011001101110" \
"1111111111111111" \
"1111111011111111" \
"1111111111111111" \
"1111111011111111"[((unsigned)(X))&0xff] == '1')
#define isidchar(X) is8bitalnum(X)
#ifndef HAVE_ISGRAPH
#define isgraph(X) (ispunct(X) || isupper(X) || islower(X) || isdigit(X))
#endif /* !HAVE_ISGRAPH */
/*
* #define ALIGNOF(X) __alignof__(X)
* #define ALIGNOF(X) (sizeof(X)>ALIGN_BOUND?ALIGN_BOUND:( 1<<my_log2(sizeof(X))))
*/
#define ALIGNOF(X) ((int)&(((struct { char ignored_ ; X fooo_; } *)0)->fooo_))
#define DO_ALIGN(X,Y) (((long)(X)+((Y)-1)) & -(Y))
#define CONSTANT_STRLEN(X) (sizeof(X) - sizeof(""))
#endif