Advertisement
xiahanlu

Cl/Gcc编译设置

Oct 13th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.78 KB | None | 0 0
  1. /* type and settings for compiler, common header
  2.  *
  3.  * Copyright (C) 2018 moecmks
  4.  * This file is part of KS3578.
  5.  *
  6.  * do What The Fuck you want to Public License
  7.  *
  8.  * Version 1.0, March 2000
  9.  * Copyright (C) 2000 Banlu Kemiyatorn (]d).
  10.  * 136 Nives 7 Jangwattana 14 Laksi Bangkok
  11.  * Everyone is permitted to copy and distribute verbatim copies
  12.  * of this license document, but changing it is not allowed.
  13.  *
  14.  * Ok, the purpose of this license is simple
  15.  * and you just
  16.  *
  17.  * DO WHAT THE FUCK YOU WANT TO.
  18.  */
  19.  
  20. #ifndef _CONFIG_H
  21. #define _CONFIG_H 1
  22.  
  23. #ifdef _WIN32
  24. # if defined (_UNICODE) || defined (UNICODE)
  25. #  define UCS2
  26. # endif
  27. # define _CRT_SECURE_NO_DEPRECATE
  28. #endif
  29.  
  30. #include <stdint.h>
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33. #include <string.h>
  34. #include <process.h>
  35. #include <assert.h>
  36. #include <string.h>
  37. #include <math.h>
  38.  
  39. #ifdef __cplusplus
  40. # define ks_null nullptr
  41. #else
  42. # define ks_null ((void *)0)
  43. #endif  
  44.  
  45. #ifndef STATIC_DEFINED
  46. # define STATIC static
  47. #endif
  48.  
  49. typedef int ks_bool;
  50. # define ks_false 0
  51. # define ks_true 1
  52.  
  53. typedef int8_t ks_int8;
  54. typedef int16_t ks_int16;
  55. typedef int32_t ks_int32;
  56. typedef int64_t ks_int64;
  57. typedef uint8_t ks_uint8;
  58. typedef uint16_t ks_uint16;
  59. typedef uint32_t ks_uint32;
  60. typedef uint64_t ks_uint64;
  61. typedef float ks_float;
  62. typedef double ks_double;
  63. typedef signed int ks_int;
  64. typedef unsigned int ks_uint;
  65. typedef intptr_t ks_intptr;
  66. typedef unsigned int ks_uint;
  67. typedef void ks_void;
  68.  
  69. # define KS_UINT8_CAST(x) ((ks_uint8)(x))
  70. # define KS_UINT16_CAST(x) ((ks_uint16)(x))
  71. # define KS_UINT32_CAST(x) ((ks_uint32)(x))
  72. # define KS_UINT64_CAST(x) ((ks_uint64)(x))
  73. # define KS_INT8_CAST(x) ((ks_int8)(x))
  74. # define KS_INT16_CAST(x) ((ks_int16)(x))
  75. # define KS_INT32_CAST(x) ((ks_int32)(x))
  76. # define KS_INT64_CAST(x) ((ks_int64)(x))
  77. # define KS_FLOAT_CAST(x) ((ks_float)(x))
  78. # define KS_DOUBLE_CAST(x) ((ks_double)(x))
  79.  
  80. #if defined (_MSC_VER) || defined (__ICC) || defined (__INTEL_COMPILER) /* MSVC/ICC starting... */
  81. # define ks_finline static  __forceinline
  82. # define ks_dinline         __declspec(noinline)
  83. # define ks_callstd         __stdcall
  84. # define ks_callc           __cdecl
  85. # define ks_cvalign(x)      __declspec(align(x))
  86. # define ks_cvimpl          __declspec(dllexport)
  87. #elif defined (__GNUC__) || defined (__GNUG__) /* MSVC/ICC end... GNUC starting */
  88. # define ks_finline static  __attribute__((always_inline))
  89. # define ks_dinline         __attribute__((noinline))
  90. # define ks_callstd         __attribute__((stdcall))
  91. # define ks_callc           __attribute__((cdecl))
  92. # define ks_cvalign(x)      __attribute__((aligned(x)))
  93. # define ks_cvimpl          __attribute__((dllexport))
  94. #else /* unsupported */
  95. # error unsupported compiler!
  96. #endif
  97. # define KS_CMP_EQUAL 0
  98. # define KS_CMP_ABOVE 1
  99. # define KS_CMP_LOW 2
  100. # define KS_CMP_NaN 3
  101.  
  102. ks_finline
  103. int ks_cmp0_double (ks_double *value) {
  104.   /*  XXX: IEEE754  */
  105.   ks_int64 *v = (ks_int64 *)(value);
  106.   /* S:nocare M and E is 0 */
  107.   if (! (v[0] & 0x7FFFFFFFFFFFFFFF)) /* -0 or +0*/
  108.     return KS_CMP_EQUAL;
  109.   if (  ( ((ks_int32 *)&v[0])[1] & 0x80000000))
  110.     return KS_CMP_LOW;
  111.   else
  112.     return KS_CMP_ABOVE;
  113. }
  114.  
  115. #ifdef _WIN32
  116. # ifdef _MSC_VER
  117. #  define _DEBUG_BREAK() _asm int 3
  118. # else
  119. # endif
  120. #endif
  121.  
  122. /* some hardware settings. */
  123. #define TIMER_DIVIDER_SAME_FREQ_BOTH_CBG_DMG_BASE_DMG
  124. #define JOYPAD_FREQ_IN_DMG 50.3
  125. #define JOYPAD_FREQ_IN_CGB 50.3
  126. #define JOYPAD_INTERRUPT_GEN_ENABLE
  127. #define JOYPAD_LOAD_ACTION_IN_P1415_ALLOPEN 3 /* 0:OR 1:AND 2:XOR 3:AND-NOT */
  128. #define TIMER_RESET_IN_RESET_FREQ_MOD_
  129. #define PPU_POST_RENDER_TIME 0 /* 0:VBLANK START 1:VBLANK END. */
  130. /* #define PPU_SPRITE_LIMIT10_IN_SCANLINE */
  131.  
  132. #ifdef UCS2
  133. typedef  wchar_t host_char;
  134. #else
  135. typedef  char host_char;
  136. #endif
  137.  
  138. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement