Advertisement
Xetrill

lxs_conf.h

Mar 17th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 20.23 KB | None | 0 0
  1. #ifndef lxs_conf_h
  2. #define lxs_conf_h 1
  3.  
  4.  
  5. ////////////////////////////////////////////////////////////////////////////////
  6. /// LUAXS_DEBUG
  7. ///
  8. /// Defined as 0/1 or undefined.
  9. /// Enables debug functions and macros, most notably this affects lxs_assert().
  10. ///
  11. /// This setting is not related to NDEBUG or project configuration.
  12. ///
  13. /// Macros:
  14. ///     lxs_assert(L, cond)
  15. ///
  16. ///     lxs_assert_stack_begin(L)
  17. ///         Used in conjunction with lxs_assert_stack_end() to verify how a
  18. ///         function increases or decreases stack size.
  19. ///         This macro captures the current stack size in a variable named
  20. ///         '__top__'.
  21. ///        
  22. ///     lxs_assert_stack_end(L, n)
  23. ///         Used in conjunction with lxs_assert_stack_begin() to verify how a
  24. ///         function increases or decreases stack size.
  25. ///         This macro verifies the earlier captured stack size with a specified
  26. ///         delta, if the delta should not much with the current stack size the
  27. ///         assertion triggers/fails.
  28. ///        
  29. ///         Usage example:
  30. ///         int get_pi(lua_State const *L)
  31. ///         {
  32. ///             lxs_assert_stack_begin(L);  // top = n
  33. ///             lua_pushinteger(L, M_PI);
  34. ///             lxs_assert_stack_end(L, 1); // top = n + 1
  35. ///             return 1;
  36. ///         }
  37. ///
  38. ///     lxs_assert_stack_at(L, n)
  39. ///         Verifies the current stack size matches a specified number.
  40. ///
  41. #ifndef LUAXS_DEBUG
  42.     #define LUAXS_DEBUG 1
  43. #endif
  44.  
  45.  
  46.  
  47. ////////////////////////////////////////////////////////////////////////////////
  48. /// LUAXS_CLOG
  49. ///
  50. /// Defined as 0/1 or undefined.
  51. /// Controls logging macros.
  52. ///
  53. /// Macros:
  54. ///     CLOG(L, fmt, ...)
  55. ///     CERR(L, fmt, ...)
  56. ///     CWRN(L, fmt, ...)
  57. ///     CIFO(L, fmt, ...)
  58. ///     CDBG(L, fmt, ...)
  59. ///         Writes a single formatted message to LUAXS_CLOG_STREAM.
  60. ///         The message always contains the current Lua state (pointer address),
  61. ///         the current file and line number as well as the current function
  62. ///         name.
  63. ///        
  64. ///         CDBG messages will only be printed/compiled if LUAXS_DEBUG is 1.
  65. ///        
  66. ///     CLOG_STACK(L)
  67. ///         Dumps Lua's stack in a human readable form to CLOG_STREAM.
  68. ///         Stack numbers are provided absolute and relative.
  69. ///         The stack is iterated from its bottom up.
  70. ///     CLOG_STACK_REV(L)
  71. ///         Sames as CLOG_STACK(), except in reverse.
  72. ///
  73. ///     CLOG_FLUSH(L)
  74. ///         Flushes the LUAXS_CLOG_STREAM buffer.
  75. ///         When LUAXS_DEBUG is 1, the buffer gets  flushed as soon as new data
  76. ///         is available.
  77. ///        
  78. ///     lxs_assert(L, cond)
  79. ///         Modifies lxs_assert() to log failed assertions via CERR().
  80. ///
  81. /// This option is expected to be enabled (or undefined).
  82. ///
  83. #ifndef LUAXS_CLOG
  84.     #define LUAXS_CLOG 1
  85. #endif
  86.  
  87. ////////////////////////////////////////////////////////////////////////////////
  88. /// LUAXS_CLOG_STREAM (LUAXS_CLOG)
  89. ///
  90. /// Defined as a global FILE* variable or function call or undefined.
  91. /// Specifies the stream that is used for messaging and logging. This can be
  92. /// a function call returning a FILE* structure and likewise can just be stdout.
  93. ///
  94. #ifndef LUAXS_CLOG_STREAM
  95.     #define LUAXS_CLOG_STREAM stdout
  96. #endif
  97.  
  98.  
  99. ////////////////////////////////////////////////////////////////////////////////
  100. /// LUAXS_EXTENT_SCRIPTS_ONLY
  101. ///
  102. /// Defined as 0/1 or undefined.
  103. /// LuaJIT creates two lua_State instances, and if this option is enabled only
  104. /// the state which is used to process scripts will be extended.
  105. ///
  106. /// The other state is used by the jitter to compile traces.
  107. ///
  108. /// There shouldn't be any need to disable this.
  109. ///
  110. #ifndef LUAXS_EXTENT_SCRIPTS_ONLY
  111.     #define LUAXS_EXTENT_SCRIPTS_ONLY 1
  112. #endif
  113.  
  114.  
  115. ////////////////////////////////////////////////////////////////////////////////
  116. /// LUAXS_STR_LJ2_CTYPE
  117. ///
  118. /// Defined to 0/1 or undefined.
  119. /// Changes the implementation used for character type operations.
  120. /// When set to 0, the CRT library 'ctype.h' is used.
  121. /// When set to 1, the same implementation as in LuaJIT 2 is used.
  122. ///
  123. /// Disabled by default, as my benchmarks for 'tolower' and 'isdigit' showed
  124. /// that at best the LJ2 implementation gets even to the CRT.
  125. ///
  126. #ifndef LUAXS_STR_LJ2_CTYPE
  127.     #define LUAXS_STR_LJ2_CTYPE 0
  128. #endif
  129.  
  130.  
  131.  
  132. ////////////////////////////////////////////////////////////////////////////////
  133. /// LUAXS_STR_INITIAL_CAPACITY
  134. ///
  135. /// Defined to a positive integer which is a power of 2 or undefined.
  136. /// Specifies the amount of memory in bytes which are allocated if not
  137. /// explicitly specified.
  138. /// This value must be positive and should be a power of 2.
  139. ///
  140. #ifndef LUAXS_STR_INITIAL_CAPACITY
  141.     #define LUAXS_STR_INITIAL_CAPACITY 256
  142. #endif
  143.  
  144.  
  145. ////////////////////////////////////////////////////////////////////////////////
  146. /// LUAXS_STR_GROWTH_FACTOR
  147. ///
  148. /// Defined to a positive single greater than 1.0 or undefined.
  149. /// Buffer re-allocation growth factor. The buffers current size is multiplied
  150. /// with this value and then the rounded to the nearest power of 2.
  151. ///
  152. #ifndef LUAXS_STR_GROWTH_FACTOR
  153.     #define LUAXS_STR_GROWTH_FACTOR 1.5f
  154. #endif
  155.  
  156.  
  157. ////////////////////////////////////////////////////////////////////////////////
  158. /// LUAXS_STR_READONLY_OPTIONS
  159. ///
  160. /// Defined as 0/1 or undefined.
  161. /// Handles if 'initial capacity' and 'growth factor' can be changed globally
  162. /// for a lua_State from Lua.
  163. /// If enabled 'default_capacity' and 'growth_factor' are pushes as constants
  164. /// to the buffer library.
  165. /// If disabled 'default_capacity' and 'growth_factor' are functions, getters
  166. /// and setters.
  167. /// The setters cannot specify arbitrary values; 'growth_factor' must be grater
  168. /// 1.0 and 'default_capacity' is checked against LUAXS_STR_MAX_SINGLE_EXPANSION
  169. /// and LUAXS_STR_MAX_TOTAL_EXPANSION unless they are set to 0.
  170. ///
  171. #ifndef LUAXS_STR_READONLY_OPTIONS
  172.     #define LUAXS_STR_READONLY_OPTIONS 1
  173. #endif
  174.  
  175.  
  176. ////////////////////////////////////////////////////////////////////////////////
  177. /// LUAXS_STR_MAX_SINGLE_EXPANSION
  178. ///
  179. /// Defined to a positive integer including zero (to disable) or undefined.
  180. /// Specifies the largest possible single reallocation that is permitted.
  181. /// This affects every lxs_string function that can request additional memory.
  182. ///
  183. /// Using a value of 0 disables this check.
  184. ///
  185. #ifndef LUAXS_STR_MAX_SINGLE_EXPANSION
  186.     #define LUAXS_STR_MAX_SINGLE_EXPANSION 10240
  187. #endif
  188.  
  189.  
  190. ////////////////////////////////////////////////////////////////////////////////
  191. /// LUAXS_STR_MAX_TOTAL_EXPANSION
  192. ///
  193. /// Defined to a positive integer including zero (to disable) or undefined.
  194. /// Specifies the overall largest possible single (re)allocation that is
  195. /// permitted.
  196. ///
  197. /// Using a value of 0 disables this check.
  198. ///
  199. #ifndef LUAXS_STR_MAX_TOTAL_EXPANSION
  200.     #define LUAXS_STR_MAX_TOTAL_EXPANSION 40960
  201. #endif
  202.  
  203.  
  204. ////////////////////////////////////////////////////////////////////////////////
  205. /// LUAXS_STR_PERSISTENT_BUFFER
  206. ///
  207. /// EXPERIMENTAL: Currently enabling this results in a crash when quitting.
  208. ///
  209. /// If set to 1, a persistent buffer is created; much like LuaJIT 2 does.
  210. /// Which is then available for LuaJIT's internal operations and can act as a
  211. /// viable replacement luaL_Buffer with dynamic memory management.
  212. /// Currently a few functions in lstrlib and ltablib use this.
  213. ///
  214. #ifndef LUAXS_STR_PERSISTENT_BUFFER
  215.     #define LUAXS_STR_PERSISTENT_BUFFER 0
  216. #endif
  217.  
  218. ////////////////////////////////////////////////////////////////////////////////
  219. /// LUAXS_PB_INITIAL_CAPACITY (LUAXS_STR_PERSISTENT_BUFFER)
  220. ///
  221. /// Defined to a positive power of 2 integer or undefined.
  222. /// Specifies the default allocation size of persistent buffers.
  223. ///
  224. #ifndef LUAXS_PB_INITIAL_CAPACITY
  225.     #define LUAXS_PB_INITIAL_CAPACITY 1024
  226. #endif
  227.  
  228. ////////////////////////////////////////////////////////////////////////////////
  229. /// LUAXS_PB_ONDEMAND_FIBERS (LUAXS_STR_PERSISTENT_BUFFER)
  230. ///
  231. /// Defined as 0/1 or undefined.
  232. /// Changes how persistent buffers are allocated for Lua threads (coroutines).
  233. /// If enabled persistent buffers are only allocated when needed.
  234. /// If disabled persistent buffers are always allocated.
  235. ///
  236. #ifndef LUAXS_PB_ONDEMAND_FIBERS
  237.     #define LUAXS_PB_ONDEMAND_FIBERS 0
  238. #endif
  239.  
  240.  
  241.  
  242. ////////////////////////////////////////////////////////////////////////////////
  243. /// LUAXS_EASTL_LUAM_MALLOC
  244. ///
  245. /// EXPERIMENTAL: In its current state luaM_* functions are not usable.
  246. ///
  247. /// Defined as 0/1 or undefined.
  248. /// Changes how the EASTL allocator works (leastl.hpp; LuaAllocator:allocator).
  249. /// If enabled, it will use luaM_malloc/luaM_freemem -- this method does not
  250. /// support aligned and/or offset allocations.
  251. /// If disabled, it will use _aligned_offset_malloc/_aligned_free.
  252. ///
  253. #ifndef LUAXS_EASTL_LUAM_MALLOC
  254.     #define LUAXS_EASTL_LUAM_MALLOC 0
  255. #endif
  256.  
  257.  
  258.  
  259. ////////////////////////////////////////////////////////////////////////////////
  260. /// LUAXS_EXTEND_CORE
  261. ///
  262. /// Defined as 0/1 or undefined.
  263. /// Global switch to enable or disable all extensions.
  264. /// See LUAXS_EXTEND_CORE_* for specific options/features.
  265. ///
  266. #ifndef LUAXS_EXTEND_CORE
  267.     #define LUAXS_EXTEND_CORE 1
  268. #endif
  269.  
  270.  
  271.  
  272. ////////////////////////////////////////////////////////////////////////////////
  273. /// LUAXS_CORE_TERSE
  274. ///
  275. /// Defined as 0/1 or undefined.
  276. /// Makes Lua more terse, by omitted useless information. Useless means full
  277. /// file paths; they are useless because the root can only be where the game
  278. /// is installed.
  279. ///
  280. /// This changes luaO_chunkid(), specifically how it handles lua_Debug.short_src.
  281. ///
  282. #ifndef LUAXS_CORE_TERSE
  283.     #define LUAXS_CORE_TERSE 1
  284. #endif
  285.  
  286.  
  287.  
  288. ////////////////////////////////////////////////////////////////////////////////
  289. /// LUAXS_CORE_LUASTACK
  290. ///
  291. /// Defined as 0/1 or undefined.
  292. /// Changes how Lua outputs error information.
  293. /// If enabled, an attempt is made to append a Lua stack representation to
  294. /// to the error message/output.
  295. ///
  296. /// To help with understanding the new information the whole Lua library is
  297. /// printed to stdout, if LUAXS_CLOG is enabled as well. This allows for
  298. /// otherwise meaningless function pointer addresses to be mapped to a function.
  299. ///
  300. #ifndef LUAXS_CORE_LUASTACK
  301.     #define LUAXS_CORE_LUASTACK 1
  302. #endif
  303.  
  304. ////////////////////////////////////////////////////////////////////////////////
  305. /// LUA_LUASTACK_TERSE (LUAXS_CORE_LUASTACK)
  306. ///
  307. /// Defined as a positive integer including zero or undefined.
  308. /// If enabled (greater zero), truncates long strings down to the specified
  309. /// value.
  310. /// A value of 77 will result in a column break at column 80.
  311. /// If disabled (zero), strings will be printed however long they are.
  312. ///
  313. #ifndef LUA_LUASTACK_TERSE
  314.     #define LUA_LUASTACK_TERSE 0
  315. #endif
  316.  
  317.  
  318.  
  319. ////////////////////////////////////////////////////////////////////////////////
  320. /// LUAXS_CORE_ATEXIT
  321. ///
  322. /// Defined to 0/1 or undefined.
  323. /// This allows for a loose global hook to be defined from Lua.
  324. /// If enabled, whenever Lua exits (no matter how) it will try to locate a
  325. /// function called 'atexit' in the global scope (_G/LUA_GLOBALSINDEX) and if so
  326. /// it is called providing the best possible information on why or what failed.
  327. /// If disabled, nothing happens.
  328. ///
  329. /// The function signature is as follows:
  330. ///     atexit(errobj, from_error, from_pcall)
  331. ///         errobj: undefined; whatever is at the top of the stack.
  332. ///             In almost all cases this will a be error message.
  333. ///         from_error: boolean; whether an error occurred or not.
  334. ///             If Lua exits gracefully, this will be false otherwise true.
  335. ///         from_pcall: boolean; whether Lua is running in protected mode.
  336. ///             Protected/sandbox mode is used by Lua's pcall and xpcall
  337. ///             functions.
  338. ///
  339. /// Usage example:
  340. ///     function atexit(errobj, from_error, from_pcall)
  341. ///         local f = io.stdout
  342. ///         f:write('\n=== atexit ===\n')
  343. ///         f:write('  errobj:     ', type(errobj), '\n')
  344. ///         f:write('  from_error: ', tostring(from_error), '\n')
  345. ///         f:write('  from_pcall: ', tostring(from_pcall), '\n')
  346. ///         f:write('  tostring(errobj):  \'', tostring(errobj) , '\'\n')
  347. ///         f:write('=== /atexit ===\n')
  348. ///         f:flush()
  349. ///     end
  350. ///
  351. #ifndef LUAXS_CORE_ATEXIT
  352.     #define LUAXS_CORE_ATEXIT 1
  353. #endif
  354.  
  355.  
  356.  
  357. ////////////////////////////////////////////////////////////////////////////////
  358. /// LUAXS_CORE_TRACEBACK
  359. ///
  360. /// EXPERIMENTAL: This feature is not fully functional.
  361. ///
  362. /// Defined to 0/1 or undefined.
  363. /// Changes (or rather attempts to change) what output is provided when an error
  364. /// occurs.
  365. /// If enabled, an implicit call to debug.traceback() is made and it's output
  366. /// appended to whatever error message exists.
  367. /// If disabled, nothing happens; vanilla behavior.
  368. ///
  369. /// While it works, most of the time, the times when it doesn't, it hides error
  370. /// messages. LuaUnit might be the best example of this, as soon as this option
  371. /// is enabled, LuaUnit will only spit out 'function: <pointer>' instead of what
  372. /// assertion actually failed.
  373. ///
  374. #ifndef LUAXS_CORE_TRACEBACK
  375.     #define LUAXS_CORE_TRACEBACK 0
  376. #endif
  377.  
  378. ////////////////////////////////////////////////////////////////////////////////
  379. /// LUAXS_TRACEBACK_TOSTRING (LUAXS_CORE_TRACEBACK)
  380. ///
  381. /// Defined to 0/1 or undefined.
  382. /// Only relevant if LUAXS_EXTEND_CORE and LUAXS_CORE_TRACEBACK are defined.
  383. /// If set to 1, Lua's tostring() function is called if the error object isn't a
  384. /// string.
  385. ///
  386. #ifndef LUAXS_TRACEBACK_TOSTRING
  387.     #define LUAXS_TRACEBACK_TOSTRING 0
  388. #endif
  389.  
  390. ////////////////////////////////////////////////////////////////////////////////
  391. /// LUAXS_TRACEBACK_FROMREGISTRY (LUAXS_CORE_TRACEBACK)
  392. ///
  393. /// Defined to 0/1 or undefined.
  394. /// When enabled, the debug.traceback function is saved in the Lua registry
  395. /// table. Which somewhat stabilizes the traceback feature. Because Lua allows
  396. /// function to be overwritten.
  397. /// It's still possible through the debug library to do just that, but not as
  398. /// accessible.
  399. ///
  400. #ifndef LUAXS_TRACEBACK_FROMREGISTRY
  401. #define LUAXS_TRACEBACK_FROMREGISTRY 1
  402. #endif
  403.  
  404. ////////////////////////////////////////////////////////////////////////////////
  405. /// LUAXS_TRACEBACK_REGISTRYKEY (LUAXS_TRACEBACK_FROMREGISTRY)
  406. ///
  407. /// Defined to a unique string or undefined.
  408. /// Specifies the string which is used to store the debug.traceback function
  409. /// in the Lua registry table.
  410. /// As this is a key string, it has to be unique.
  411. ///
  412. #ifndef LUAXS_TRACEBACK_REGISTRYKEY
  413.     #define LUAXS_TRACEBACK_REGISTRYKEY "xs_traceback"
  414. #endif
  415.  
  416.  
  417.  
  418. ////////////////////////////////////////////////////////////////////////////////
  419. /// LUAXS_CORE_SIMD
  420. ///
  421. /// EXPERIMENTAL: This feature is not fully implemented nor tested.
  422. ///
  423. /// Defined to 0/1 or undefined.
  424. /// If enabled, some Lua's internals use SIMD instructions instead of the CRT.
  425. /// If disabled, C's math.h is used.
  426. /// Note however that regardless of this option SSE3 is required (fisttp).
  427. ///
  428. /// IMPORTANT: This define is controlled via project configuration.
  429. ///
  430. //#define LUAXS_CORE_SIMD 0
  431.  
  432.  
  433.  
  434. ////////////////////////////////////////////////////////////////////////////////
  435. /// LUAXS_CORE_FORMAT
  436. ///
  437. /// Defined as 0/1/2 or undefined.
  438. /// Changes how string formatting is implemented in Lua's core internals.
  439. /// It does so by changing the implementation in luaO_pushvfstring.
  440. ///
  441. /// Allowed values:
  442. ///   0: No changes are made; vanilla behavior
  443. ///   1: support for %x and %X is added
  444. ///   2: the whole implementation is swapped out and vsprintf is called directly
  445. ///      and only once, instead of for each and every single token
  446. /// EXPERIMENTAL: Needs to be considered unstable, because I have to assume that
  447. ///               the original implementation was needed. At least at some point
  448. ///               during Lua's development.
  449. ///               But as it's now, I can't see any reason for re-implementing
  450. ///               printf; even less so by using printf.
  451. ///
  452. #ifndef LUAXS_CORE_FORMAT
  453.     #define LUAXS_CORE_FORMAT 2
  454. #endif
  455.  
  456.  
  457.  
  458. ////////////////////////////////////////////////////////////////////////////////
  459. /// LUAXS_EXTEND_*
  460. ///
  461. /// Defined to 0/1 or undefined.
  462. /// LUAXS_EXTEND_* extend a specific library. Adding additional functionality.
  463. /// Mostly this just means new functions.
  464. ///
  465. /// LUAXS_EXTEND_DBLIB:
  466. /// LUAXS_EXTEND_IOLIB:
  467. /// LUAXS_EXTEND_MATHLIB:
  468. /// LUAXS_EXTEND_STRLIB:
  469. /// LUAXS_EXTEND_TABLIB:
  470. ///
  471. #ifndef LUAXS_EXTEND_DBLIB
  472.     #define LUAXS_EXTEND_DBLIB 1
  473. #endif
  474. #ifndef LUAXS_EXTEND_IOLIB
  475.     #define LUAXS_EXTEND_IOLIB 1
  476. #endif
  477. #ifndef LUAXS_EXTEND_MATHLIB
  478.     #define LUAXS_EXTEND_MATHLIB 1
  479. #endif
  480. #ifndef LUAXS_EXTEND_STRLIB
  481.     #define LUAXS_EXTEND_STRLIB 1
  482. #endif
  483. #ifndef LUAXS_EXTEND_TABLIB
  484.     #define LUAXS_EXTEND_TABLIB 1
  485. #endif
  486. //#define LUAXS_EXTEND_BASELIB 1
  487. //#define LUAXS_EXTEND_OSLIB 1
  488.  
  489.  
  490.  
  491. ////////////////////////////////////////////////////////////////////////////////
  492. /// LUAXS_ADDLIB_*
  493. ///
  494. /// Defined to 0/1 or undefined.
  495. /// Each LUAXS_ADDLIB_* specifies if new non-default libraries shall be added
  496. /// to Lua's library repository or not.
  497. ///
  498. /// Unless otherwise specified, each new library luaopen_* function is called
  499. /// from luaopen_jit, as it's last operation.
  500. /// This is because, as it happens, STALKER loads the JITTER last.
  501. ///
  502. /// LUAXS_ADDLIB_BUFFER:
  503. ///     Implements lxs_string as a Lua library thus providing a mutable string
  504. ///     buffer.
  505. ///     Which can outperform many vanilla string operations, especially those
  506. ///     which require many writes.
  507. ///
  508. /// LUAXS_ADDLIB_MARSHAL:
  509. ///     Provides a serialization library, which is aware of cycles and
  510. ///     functions as well as fast.
  511. ///     One caveat though is, it serializes to a string and doesn't provide
  512. ///     capabilities to instead use a file.
  513. ///
  514. /// LUAXS_ADDLIB_GAME:
  515. ///
  516. #ifndef LUAXS_ADDLIB_BUFFER
  517.     #define LUAXS_ADDLIB_BUFFER 1
  518. #endif
  519. #ifndef LUAXS_ADDLIB_MARSHAL
  520.     #define LUAXS_ADDLIB_MARSHAL 1
  521. #endif
  522. #ifndef LUAXS_ADDLIB_CONTAINER
  523.     #define LUAXS_ADDLIB_CONTAINER 0
  524. #endif
  525. #ifndef LUAXS_ADDLIB_GAME
  526.     #define LUAXS_ADDLIB_GAME 0
  527. #endif
  528. #ifndef LUAXS_ADDLIB_MEMORY
  529.     #define LUAXS_ADDLIB_MEMORY 0
  530. #endif
  531.  
  532.  
  533.  
  534. ////////////////////////////////////////////////////////////////////////////////
  535. /// LUAXS_STREAMLINE_*
  536. ///
  537. /// Defined to 0/1 or undefined.
  538. /// Streamlines a specific library. Typically this means
  539. /// code/functionality that would never be used in STALKER is removed.
  540. ///
  541. /// LUAXS_STREAMLINE_LOADLIB:
  542. ///     loadlib.c: require() is only using 3 loader functions instead of 4.
  543. ///
  544. #ifndef LUAXS_STREAMLINE_LOADLIB
  545.     #define LUAXS_STREAMLINE_LOADLIB 1
  546. #endif
  547.  
  548.  
  549.  
  550. ////////////////////////////////////////////////////////////////////////////////
  551. /// LUAXS_MATHLIB_SIMD
  552. ///
  553. /// EXPERIMENTAL: This feature is not fully implemented nor tested.
  554. ///
  555. /// Defined to 0/1 or undefined.
  556. /// Changes some implementations for Lua's math library to use SIMD instructions.
  557. /// Support is CPU dependent.
  558. ///
  559. /// IMPORTANT: This define is controlled via project configuration.
  560. ///
  561. //#define LUAXS_MATHLIB_SIMD 0
  562.  
  563.  
  564.  
  565. //------------------------------------------------------------------------------
  566.  
  567. #if defined(LUA_CORE) && LUAXS_CORE_SIMD
  568. #  include "lxsext_simd.h"
  569. #endif
  570.  
  571.  
  572.  
  573. //------------------------------------------------------------------------------
  574.  
  575. #if LUAXS_STR_PERSISTENT_BUFFER && !defined(LUAXS_PB_INITIAL_CAPACITY)
  576. #  error LUAXS_PB_INITIAL_CAPACITY needs to be defined
  577. #endif
  578.  
  579. #if defined(LUAXS_STR_MAX_SINGLE_EXPANSION) && \
  580.     defined(LUAXS_STR_MAX_TOTAL_EXPANSION)
  581. #  if LUAXS_STR_MAX_TOTAL_EXPANSION <= LUAXS_STR_MAX_SINGLE_EXPANSION
  582. #    error LUAXS_STR_MAX_TOTAL_EXPANSION must be greater than\
  583.     LUAXS_STR_MAX_SINGLE_EXPANSION
  584. #  endif
  585. #endif
  586. #ifndef LUAXS_STR_INITIAL_CAPACITY
  587. #  error LUAXS_STR_INITIAL_CAPACITY needs to be defined
  588. #endif
  589. #ifndef LUAXS_STR_GROWTH_FACTOR
  590. #  error LUAXS_STR_GROWTH_FACTOR needs to be defined
  591. #endif
  592.  
  593. #if !defined(LUAXS_CORE_FORMAT) || \
  594.     LUAXS_CORE_FORMAT < 0       || \
  595.     LUAXS_CORE_FORMAT > 2
  596. #  error Invalid LUAXS_CORE_FORMAT value defined; use 0, 1 or 2
  597. #endif
  598.  
  599. #endif // lxs_conf_h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement