OLD | NEW |
1 /* | 1 /* |
2 american fuzzy lop - type definitions and minor macros | 2 american fuzzy lop - type definitions and minor macros |
3 ------------------------------------------------------ | 3 ------------------------------------------------------ |
4 | 4 |
5 Written and maintained by Michal Zalewski <lcamtuf@google.com> | 5 Written and maintained by Michal Zalewski <lcamtuf@google.com> |
6 | 6 |
7 Copyright 2013, 2014, 2015 Google Inc. All rights reserved. | 7 Copyright 2013, 2014, 2015 Google Inc. All rights reserved. |
8 | 8 |
9 Licensed under the Apache License, Version 2.0 (the "License"); | 9 Licensed under the Apache License, Version 2.0 (the "License"); |
10 you may not use this file except in compliance with the License. | 10 you may not use this file except in compliance with the License. |
(...skipping 26 matching lines...) Expand all Loading... |
37 Now, it only happens in circumstances where the type happens to have the | 37 Now, it only happens in circumstances where the type happens to have the |
38 expected bit width, *but* the compiler does not know that... and complains | 38 expected bit width, *but* the compiler does not know that... and complains |
39 about 'unsigned long' being unsafe to pass to %llu. | 39 about 'unsigned long' being unsafe to pass to %llu. |
40 | 40 |
41 */ | 41 */ |
42 | 42 |
43 #ifdef __x86_64__ | 43 #ifdef __x86_64__ |
44 typedef unsigned long long u64; | 44 typedef unsigned long long u64; |
45 #else | 45 #else |
46 typedef uint64_t u64; | 46 typedef uint64_t u64; |
47 #endif /* ^sizeof(...) */ | 47 #endif /* ^__x86_64__ */ |
48 | 48 |
49 typedef int8_t s8; | 49 typedef int8_t s8; |
50 typedef int16_t s16; | 50 typedef int16_t s16; |
51 typedef int32_t s32; | 51 typedef int32_t s32; |
52 typedef int64_t s64; | 52 typedef int64_t s64; |
53 | 53 |
54 #ifndef MIN | 54 #ifndef MIN |
55 # define MIN(_a,_b) ((_a) > (_b) ? (_b) : (_a)) | 55 # define MIN(_a,_b) ((_a) > (_b) ? (_b) : (_a)) |
56 # define MAX(_a,_b) ((_a) > (_b) ? (_a) : (_b)) | 56 # define MAX(_a,_b) ((_a) > (_b) ? (_a) : (_b)) |
57 #endif /* !MIN */ | 57 #endif /* !MIN */ |
(...skipping 11 matching lines...) Expand all Loading... |
69 }) | 69 }) |
70 | 70 |
71 #define R(x) (random() % (x)) | 71 #define R(x) (random() % (x)) |
72 | 72 |
73 #define STRINGIFY_INTERNAL(x) #x | 73 #define STRINGIFY_INTERNAL(x) #x |
74 #define STRINGIFY(x) STRINGIFY_INTERNAL(x) | 74 #define STRINGIFY(x) STRINGIFY_INTERNAL(x) |
75 | 75 |
76 #define MEM_BARRIER() \ | 76 #define MEM_BARRIER() \ |
77 asm volatile("" ::: "memory") | 77 asm volatile("" ::: "memory") |
78 | 78 |
| 79 #define likely(_x) __builtin_expect(!!(_x), 1) |
| 80 #define unlikely(_x) __builtin_expect(!!(_x), 0) |
| 81 |
79 #endif /* ! _HAVE_TYPES_H */ | 82 #endif /* ! _HAVE_TYPES_H */ |
OLD | NEW |