forked from kevinjlang/cpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
45 lines (32 loc) · 958 Bytes
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2018, Kevin Lang, Oath Research
#ifndef GOT_COMMON_H
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
#include <math.h>
typedef int Boolean;
typedef u_int8_t U8;
typedef u_int16_t U16;
typedef u_int32_t U32;
typedef u_int64_t U64;
typedef int16_t Short; // signed
typedef int64_t Long; // signed
#define ALL64BITS 0xffffffffffffffffULL
#define ALL32BITS 0xffffffffULL
// Do not use either of these with a shift of 0 or 64.
#define ROTATE_RIGHT_MACRO(val,shift) (((val) >> (shift)) | ((val) << (64 - (shift))))
#define ROTATE_LEFT_MACRO(val,shift) (((val) << (shift)) | ((val) >> (64 - (shift))))
/* some C syntax magic */
#define FATAL_ERROR(msg) \
do { \
fprintf (stderr, "Program failed because %s.\n", (msg)); \
fflush (stderr); \
exit(-1); \
} while (0)
// enum animal {Horse, Pig, Cow};
#define GOT_COMMON_H
#endif