Slightly faster implementation of the deadman counter
[nasm/avx512.git] / compiler.h
blobb66085598ca8db2d1ac2700fa814d143346a31e2
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2007 The NASM Authors - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the license given in the file "License"
7 * distributed in the NASM archive.
9 * ----------------------------------------------------------------------- */
12 * compiler.h
14 * Compiler-specific macros for NASM. Feel free to add support for
15 * other compilers in here.
17 * This header file should be included before any other header.
20 #ifndef NASM_COMPILER_H
21 #define NASM_COMPILER_H 1
23 #ifdef HAVE_CONFIG_H
24 # include "config.h"
25 #endif
27 /* This is required to get the standard <inttypes.h> macros when compiling
28 with a C++ compiler. This must be defined *before* <inttypes.h> is
29 included, directly or indirectly. */
30 #define __STDC_CONSTANT_MACROS 1
31 #define __STDC_LIMIT_MACROS 1
32 #define __STDC_FORMAT_MACROS 1
34 #ifdef __GNUC__
35 # if __GNUC__ >= 4
36 # define HAVE_GNUC_4
37 # endif
38 # if __GNUC__ >= 3
39 # define HAVE_GNUC_3
40 # endif
41 #endif
43 #ifdef __GNUC__
44 # define _unused __attribute__((unused))
45 #else
46 # define _unused
47 #endif
49 /* Some versions of MSVC have these only with underscores in front */
50 #include <stddef.h>
51 #include <stdarg.h>
52 #include <stdio.h>
54 #ifndef HAVE_SNPRINTF
55 # ifdef HAVE__SNPRINTF
56 # define snprintf _snprintf
57 # else
58 int snprintf(char *, size_t, const char *, ...);
59 # endif
60 #endif
62 #ifndef HAVE_VSNPRINTF
63 # ifdef HAVE__VSNPRINT
64 # define vsnprintf _vsnprintf
65 # else
66 int vsnprintf(char *, size_t, const char *, va_list);
67 # endif
68 #endif
70 #ifndef __cplusplus /* C++ has false, true, bool as keywords */
71 # ifdef HAVE_STDBOOL_H
72 # include <stdbool.h>
73 # else
74 typedef enum { false, true } bool;
75 # endif
76 #endif
78 /* Some misguided platforms hide the defs for these */
79 #if defined(HAVE_STRCASECMP) && !HAVE_DECL_STRCASECMP
80 int strcasecmp(const char *, const char *);
81 #endif
83 #if defined(HAVE_STRICMP) && !HAVE_DECL_STRICMP
84 int stricmp(const char *, const char *);
85 #endif
87 #if defined(HAVE_STRNCASECMP) && !HAVE_DECL_STRNCASECMP
88 int strncasecmp(const char *, const char *, size_t);
89 #endif
91 #if defined(HAVE_STRNICMP) && !HAVE_DECL_STRNICMP
92 int strnicmp(const char *, const char *, size_t);
93 #endif
95 #if defined(HAVE_STRSEP) && !HAVE_DECL_STRSEP
96 char *strsep(char **, const char *);
97 #endif
100 * Define this to 1 for faster performance if this is a littleendian
101 * platform which can do unaligned memory references. It is safe
102 * to leave it defined to 0 even if that is true.
104 #if defined(__i386__) || defined(__x86_64__)
105 # define X86_MEMORY 1
106 #else
107 # define X86_MEMORY 0
108 #endif
110 #endif /* NASM_COMPILER_H */