stdint.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. /*****************************************************************************/
  2. /* STDINT.H */
  3. /* */
  4. /* Copyright (c) 2002 Texas Instruments Incorporated */
  5. /* http://www.ti.com/ */
  6. /* */
  7. /* Redistribution and use in source and binary forms, with or without */
  8. /* modification, are permitted provided that the following conditions */
  9. /* are met: */
  10. /* */
  11. /* Redistributions of source code must retain the above copyright */
  12. /* notice, this list of conditions and the following disclaimer. */
  13. /* */
  14. /* Redistributions in binary form must reproduce the above copyright */
  15. /* notice, this list of conditions and the following disclaimer in */
  16. /* the documentation and/or other materials provided with the */
  17. /* distribution. */
  18. /* */
  19. /* Neither the name of Texas Instruments Incorporated nor the names */
  20. /* of its contributors may be used to endorse or promote products */
  21. /* derived from this software without specific prior written */
  22. /* permission. */
  23. /* */
  24. /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
  25. /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
  26. /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
  27. /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
  28. /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
  29. /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
  30. /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
  31. /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
  32. /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  33. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
  34. /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  35. /* */
  36. /*****************************************************************************/
  37. #ifndef _STDINT_H_
  38. #define _STDINT_H_
  39. #if __has_include(<sys/stdint.h>)
  40. #include <sys/stdint.h>
  41. #else
  42. /* 7.18.1.1 Exact-width integer types */
  43. #if defined(__MSP430__) || defined(__TMS320C55X_PLUS_BYTE__)
  44. typedef signed char int8_t;
  45. typedef unsigned char uint8_t;
  46. typedef int int16_t;
  47. typedef unsigned int uint16_t;
  48. typedef long int32_t;
  49. typedef unsigned long uint32_t;
  50. #elif defined(_TMS320C5XX) || defined(__TMS320C55X__)
  51. typedef int int16_t;
  52. typedef unsigned int uint16_t;
  53. typedef long int32_t;
  54. typedef unsigned long uint32_t;
  55. #elif defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__ARP32__) || \
  56. defined(__PRU__) || defined(__FROZEN__)
  57. typedef signed char int8_t;
  58. typedef unsigned char uint8_t;
  59. typedef short int16_t;
  60. typedef unsigned short uint16_t;
  61. typedef int int32_t;
  62. typedef unsigned int uint32_t;
  63. #elif defined (__TMS320C2000__)
  64. #if defined(__TMS320C28XX_CLA__)
  65. typedef short int16_t;
  66. typedef unsigned short uint16_t;
  67. typedef int int32_t;
  68. typedef unsigned int uint32_t;
  69. #else
  70. typedef char int8_t;
  71. typedef unsigned char uint8_t;
  72. typedef int int16_t;
  73. typedef unsigned int uint16_t;
  74. typedef long int32_t;
  75. typedef unsigned long uint32_t;
  76. #endif
  77. #endif
  78. #if defined(__TMS320C55X__)
  79. typedef long long int40_t;
  80. typedef unsigned long long uint40_t;
  81. #elif defined(_TMS320C6X) && !defined(__C6X_MIGRATION__)
  82. typedef __int40_t int40_t;
  83. typedef unsigned __int40_t uint40_t;
  84. #endif
  85. #if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__ARP32__) || \
  86. defined(__MSP430__) || defined(__PRU__) || defined(__FROZEN__)
  87. typedef long long int64_t;
  88. typedef unsigned long long uint64_t;
  89. #elif defined(__TMS320C2000__)
  90. #if defined(__TMS320C28X__) || \
  91. (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__))
  92. typedef long long int64_t;
  93. typedef unsigned long long uint64_t;
  94. #endif
  95. #endif
  96. /* 7.18.1.2 Minimum-width integer types */
  97. #if defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__MSP430__) || \
  98. defined(__TMS320C55X_PLUS_BYTE__) || defined(__ARP32__) || \
  99. defined(__PRU__) || defined(__FROZEN__)
  100. typedef int8_t int_least8_t;
  101. typedef uint8_t uint_least8_t;
  102. #elif defined(__TMS320C2000__) || defined(_TMS320C5XX) || defined(__TMS320C55X__)
  103. typedef int16_t int_least8_t;
  104. typedef uint16_t uint_least8_t;
  105. #endif
  106. typedef int16_t int_least16_t;
  107. typedef uint16_t uint_least16_t;
  108. typedef int32_t int_least32_t;
  109. typedef uint32_t uint_least32_t;
  110. #if defined(__TMS320C55X__) || \
  111. (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__))
  112. typedef int40_t int_least40_t;
  113. typedef uint40_t uint_least40_t;
  114. #endif
  115. #if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \
  116. defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__)
  117. typedef int64_t int_least64_t;
  118. typedef uint64_t uint_least64_t;
  119. #elif defined(__TMS320C2000__)
  120. #if defined(__TMS320C28X__) || \
  121. (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__))
  122. typedef int64_t int_least64_t;
  123. typedef uint64_t uint_least64_t;
  124. #else
  125. /* sorry, [u]int_least64_t not implemented for C27X, CLA */
  126. #endif
  127. #elif defined(_TMS320C5XX) || defined(__TMS320C55X__)
  128. /* sorry, [u]int_least64_t not implemented for C54x, C55x */
  129. #endif
  130. /* 7.18.1.3 Fastest minimum-width integer types */
  131. #if defined(_TMS320C5XX) || defined(__TMS320C55X__) || defined(__MSP430__)
  132. typedef int16_t int_fast8_t;
  133. typedef uint16_t uint_fast8_t;
  134. typedef int16_t int_fast16_t;
  135. typedef uint16_t uint_fast16_t;
  136. #elif defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__ARP32__) || \
  137. defined(__PRU__) || defined(__FROZEN__)
  138. typedef int32_t int_fast8_t;
  139. typedef uint32_t uint_fast8_t;
  140. typedef int32_t int_fast16_t;
  141. typedef uint32_t uint_fast16_t;
  142. #elif defined (__TMS320C2000__)
  143. #if defined(__TMS320C28XX_CLA__)
  144. typedef int32_t int_fast8_t;
  145. typedef uint32_t uint_fast8_t;
  146. typedef int32_t int_fast16_t;
  147. typedef uint32_t uint_fast16_t;
  148. #else
  149. typedef int16_t int_fast8_t;
  150. typedef uint16_t uint_fast8_t;
  151. typedef int16_t int_fast16_t;
  152. typedef uint16_t uint_fast16_t;
  153. #endif
  154. #endif
  155. typedef int32_t int_fast32_t;
  156. typedef uint32_t uint_fast32_t;
  157. #if defined(__TMS320C55X__) || \
  158. (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__))
  159. typedef int40_t int_fast40_t;
  160. typedef uint40_t uint_fast40_t;
  161. #endif
  162. #if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \
  163. defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__)
  164. typedef int64_t int_fast64_t;
  165. typedef uint64_t uint_fast64_t;
  166. #elif defined(__TMS320C2000__)
  167. #if defined(__TMS320C28X__) || \
  168. (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__))
  169. typedef int64_t int_fast64_t;
  170. typedef uint64_t uint_fast64_t;
  171. #else
  172. /* sorry, [u]int_fast64_t not implemented for C27X, CLA */
  173. #endif
  174. #elif defined(_TMS320C5XX) || defined(__TMS320C55X__)
  175. /* sorry, [u]int_fast64_t not implemented for C54x, C55x */
  176. #endif
  177. /* 7.18.1.4 Integer types capable of holding object pointers */
  178. #if defined(_TMS320C5XX) || defined(__TMS320C55X__) || \
  179. (defined(__MSP430__) && defined(__LARGE_CODE_MODEL__)) || \
  180. defined(__FROZEN__)
  181. typedef long intptr_t;
  182. typedef unsigned long uintptr_t;
  183. #elif defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__MSP430__) || \
  184. defined(__ARP32__) || defined(__PRU__)
  185. typedef int intptr_t;
  186. typedef unsigned int uintptr_t;
  187. #elif defined(__TMS320C2000__)
  188. #if defined(__TMS320C28XX_CLA__)
  189. typedef short intptr_t;
  190. typedef unsigned short uintptr_t;
  191. #else
  192. typedef long intptr_t;
  193. typedef unsigned long uintptr_t;
  194. #endif
  195. #endif
  196. /* 7.18.1.5 Greatest-width integer types */
  197. #if defined(__TMS320C55X__) || defined(__ARM_ARCH) || defined(_TMS320C6X) || \
  198. defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__) || \
  199. defined(__FROZEN__)
  200. typedef long long intmax_t;
  201. typedef unsigned long long uintmax_t;
  202. #elif defined(_TMS320C5XX)
  203. typedef long intmax_t;
  204. typedef unsigned long uintmax_t;
  205. #elif defined(__TMS320C2000__)
  206. #if defined(__TMS320C28X__) || \
  207. (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__))
  208. typedef long long intmax_t;
  209. typedef unsigned long long uintmax_t;
  210. #else /* C27X or CLA */
  211. typedef long intmax_t;
  212. typedef unsigned long uintmax_t;
  213. #endif
  214. #endif
  215. /*
  216. According to footnotes in the 1999 C standard, "C++ implementations
  217. should define these macros only when __STDC_LIMIT_MACROS is defined
  218. before <stdint.h> is included."
  219. */
  220. #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
  221. /* 7.18.2 Limits of specified width integer types */
  222. #if defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__MSP430__) || \
  223. defined(__TMS320C55X_PLUS_BYTE__) || defined(__ARP32__) || \
  224. defined(__PRU__) || defined(__FROZEN__)
  225. #define INT8_MAX 0x7f
  226. #define INT8_MIN (-INT8_MAX-1)
  227. #define UINT8_MAX 0xff
  228. #endif
  229. #define INT16_MAX 0x7fff
  230. #define INT16_MIN (-INT16_MAX-1)
  231. #define UINT16_MAX 0xffff
  232. #define INT32_MAX 0x7fffffff
  233. #define INT32_MIN (-INT32_MAX-1)
  234. #define UINT32_MAX 0xffffffff
  235. #if defined(__TMS320C55X__) || \
  236. (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__))
  237. #define INT40_MAX 0x7fffffffff
  238. #define INT40_MIN (-INT40_MAX-1)
  239. #define UINT40_MAX 0xffffffffff
  240. #endif
  241. #if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \
  242. defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__)
  243. #define INT64_MAX 0x7fffffffffffffff
  244. #define INT64_MIN (-INT64_MAX-1)
  245. #define UINT64_MAX 0xffffffffffffffff
  246. #elif defined(__TMS320C2000__)
  247. #if defined(__TMS320C28X__) || \
  248. (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__))
  249. #define INT64_MAX 0x7fffffffffffffff
  250. #define INT64_MIN (-INT64_MAX-1)
  251. #define UINT64_MAX 0xffffffffffffffff
  252. #endif
  253. #endif
  254. #if defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__MSP430__) || \
  255. defined(__TMS320C55X_PLUS_BYTE__) || defined(__ARP32__) || \
  256. defined(__PRU__) || defined(__FROZEN__)
  257. #define INT_LEAST8_MAX (INT8_MAX)
  258. #define INT_LEAST8_MIN (INT8_MIN)
  259. #define UINT_LEAST8_MAX (UINT8_MAX)
  260. #elif defined(__TMS320C2000__) || defined(_TMS320C5XX) || defined(__TMS320C55X__)
  261. #define INT_LEAST8_MAX (INT16_MAX)
  262. #define INT_LEAST8_MIN (INT16_MIN)
  263. #define UINT_LEAST8_MAX (UINT16_MAX)
  264. #endif
  265. #define INT_LEAST16_MAX (INT16_MAX)
  266. #define INT_LEAST16_MIN (INT16_MIN)
  267. #define UINT_LEAST16_MAX (UINT16_MAX)
  268. #define INT_LEAST32_MAX (INT32_MAX)
  269. #define INT_LEAST32_MIN (INT32_MIN)
  270. #define UINT_LEAST32_MAX (UINT32_MAX)
  271. #if defined(__TMS320C55X__) || \
  272. (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__))
  273. #define INT_LEAST40_MAX (INT40_MAX)
  274. #define INT_LEAST40_MIN (INT40_MIN)
  275. #define UINT_LEAST40_MAX (UINT40_MAX)
  276. #endif
  277. #if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \
  278. defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__)
  279. #define INT_LEAST64_MAX (INT64_MAX)
  280. #define INT_LEAST64_MIN (INT64_MIN)
  281. #define UINT_LEAST64_MAX (UINT64_MAX)
  282. #elif defined(__TMS320C2000__)
  283. #if defined(__TMS320C28X__) || \
  284. (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__))
  285. #define INT_LEAST64_MAX (INT64_MAX)
  286. #define INT_LEAST64_MIN (INT64_MIN)
  287. #define UINT_LEAST64_MAX (UINT64_MAX)
  288. #endif
  289. #endif
  290. #if defined(_TMS320C5XX) || defined(__TMS320C55X__)
  291. #define INT_FAST8_MAX (INT16_MAX)
  292. #define INT_FAST8_MIN (INT16_MIN)
  293. #define UINT_FAST8_MAX (UINT16_MAX)
  294. #define INT_FAST16_MAX (INT16_MAX)
  295. #define INT_FAST16_MIN (INT16_MIN)
  296. #define UINT_FAST16_MAX (UINT16_MAX)
  297. #elif defined(_TMS320C6X) || defined(__ARM_ARCH) || defined(__ARP32__) || \
  298. defined(__PRU__) || defined(__FROZEN__)
  299. #define INT_FAST8_MAX (INT32_MAX)
  300. #define INT_FAST8_MIN (INT32_MIN)
  301. #define UINT_FAST8_MAX (UINT32_MAX)
  302. #define INT_FAST16_MAX (INT32_MAX)
  303. #define INT_FAST16_MIN (INT32_MIN)
  304. #define UINT_FAST16_MAX (UINT32_MAX)
  305. #elif defined(__MSP430__)
  306. #define INT_FAST8_MAX (INT16_MAX)
  307. #define INT_FAST8_MIN (INT16_MIN)
  308. #define UINT_FAST8_MAX (UINT16_MAX)
  309. #define INT_FAST16_MAX (INT16_MAX)
  310. #define INT_FAST16_MIN (INT16_MIN)
  311. #define UINT_FAST16_MAX (UINT16_MAX)
  312. #elif defined (__TMS320C2000__)
  313. #if defined(__TMS320C28XX_CLA__)
  314. #define INT_FAST8_MAX (INT32_MAX)
  315. #define INT_FAST8_MIN (INT32_MIN)
  316. #define UINT_FAST8_MAX (UINT32_MAX)
  317. #define INT_FAST16_MAX (INT32_MAX)
  318. #define INT_FAST16_MIN (INT32_MIN)
  319. #define UINT_FAST16_MAX (UINT32_MAX)
  320. #else
  321. #define INT_FAST8_MAX (INT16_MAX)
  322. #define INT_FAST8_MIN (INT16_MIN)
  323. #define UINT_FAST8_MAX (UINT16_MAX)
  324. #define INT_FAST16_MAX (INT16_MAX)
  325. #define INT_FAST16_MIN (INT16_MIN)
  326. #define UINT_FAST16_MAX (UINT16_MAX)
  327. #endif
  328. #endif
  329. #define INT_FAST32_MAX (INT32_MAX)
  330. #define INT_FAST32_MIN (INT32_MIN)
  331. #define UINT_FAST32_MAX (UINT32_MAX)
  332. #if defined(__TMS320C55X__) || \
  333. (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__))
  334. #define INT_FAST40_MAX (INT40_MAX)
  335. #define INT_FAST40_MIN (INT40_MIN)
  336. #define UINT_FAST40_MAX (UINT40_MAX)
  337. #endif
  338. #if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \
  339. defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__)
  340. #define INT_FAST64_MAX (INT64_MAX)
  341. #define INT_FAST64_MIN (INT64_MIN)
  342. #define UINT_FAST64_MAX (UINT64_MAX)
  343. #elif defined(__TMS320C2000__)
  344. #if defined(__TMS320C28X__) || \
  345. (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__))
  346. #define INT_FAST64_MAX (INT64_MAX)
  347. #define INT_FAST64_MIN (INT64_MIN)
  348. #define UINT_FAST64_MAX (UINT64_MAX)
  349. #endif
  350. #endif
  351. #if defined(__MSP430__) && !defined(__LARGE_CODE_MODEL__)
  352. #define INTPTR_MAX (INT16_MAX)
  353. #define INTPTR_MIN (INT16_MIN)
  354. #define UINTPTR_MAX (UINT16_MAX)
  355. #elif defined(__FROZEN__)
  356. #define INTPTR_MAX (INT64_MAX)
  357. #define INTPTR_MIN (INT64_MIN)
  358. #define UINTPTR_MAX (UINT64_MAX)
  359. #else
  360. #define INTPTR_MAX (INT32_MAX)
  361. #define INTPTR_MIN (INT32_MIN)
  362. #define UINTPTR_MAX (UINT32_MAX)
  363. #endif
  364. #if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \
  365. defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__)
  366. #define INTMAX_MIN (INT64_MIN)
  367. #define INTMAX_MAX (INT64_MAX)
  368. #define UINTMAX_MAX (UINT64_MAX)
  369. #elif defined(__TMS320C55X__)
  370. #define INTMAX_MIN (INT40_MIN)
  371. #define INTMAX_MAX (INT40_MAX)
  372. #define UINTMAX_MAX (UINT40_MAX)
  373. #elif defined(_TMS320C5XX)
  374. #define INTMAX_MIN (INT32_MIN)
  375. #define INTMAX_MAX (INT32_MAX)
  376. #define UINTMAX_MAX (UINT32_MAX)
  377. #elif defined(__TMS320C2000__)
  378. #if defined(__TMS320C28X__) || \
  379. (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__))
  380. #define INTMAX_MIN (INT64_MIN)
  381. #define INTMAX_MAX (INT64_MAX)
  382. #define UINTMAX_MAX (UINT64_MAX)
  383. #else
  384. #define INTMAX_MIN (INT32_MIN)
  385. #define INTMAX_MAX (INT32_MAX)
  386. #define UINTMAX_MAX (UINT32_MAX)
  387. #endif
  388. #endif
  389. /* 7.18.3 Limits of other integer types */
  390. #if defined(_TMS320C5XX) || defined(__TMS320C55X__) || \
  391. (defined(__MSP430__) && !defined(__LONG_PTRDIFF_T__))
  392. #define PTRDIFF_MAX (INT16_MAX)
  393. #define PTRDIFF_MIN (INT16_MIN)
  394. #elif defined(__TMS320C2000__) || defined(__MSP430__) || \
  395. (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__)) || \
  396. defined(__ARM_ARCH) || defined(__ARP32__) || defined(__PRU__)
  397. #define PTRDIFF_MAX (INT32_MAX)
  398. #define PTRDIFF_MIN (INT32_MIN)
  399. #elif defined(__FROZEN__)
  400. #define PTRDIFF_MAX (INT64_MAX)
  401. #define PTRDIFF_MIN (INT64_MIN)
  402. #endif
  403. #if defined(_TMS320C5XX) || defined(__TMS320C55X__) || defined(__MSP430__)
  404. #define SIG_ATOMIC_MIN (INT16_MIN)
  405. #define SIG_ATOMIC_MAX (INT16_MAX)
  406. #elif defined(__TMS320C2000__) || defined(_TMS320C6X) || defined(__FROZEN__) || \
  407. defined(__ARM_ARCH) || defined(__ARP32__) || defined(__PRU__)
  408. #define SIG_ATOMIC_MIN (INT32_MIN)
  409. #define SIG_ATOMIC_MAX (INT32_MAX)
  410. #endif
  411. #if defined(_TMS320C5XX) || defined(__TMS320C55X__) || \
  412. (defined(__MSP430__) && !defined(__LONG_PTRDIFF_T__))
  413. #define SIZE_MAX (UINT16_MAX)
  414. #elif defined(__TMS320C2000__) || defined(__MSP430__) || \
  415. (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__)) || \
  416. defined(__ARM_ARCH) || defined(__ARP32__) || defined(__PRU__)
  417. #define SIZE_MAX (UINT32_MAX)
  418. #elif defined(__FROZEN__)
  419. #define SIZE_MAX (UINT64_MAX)
  420. #endif
  421. #ifndef WCHAR_MAX
  422. #if !defined(__TI_WCHAR_T_BITS__) || __TI_WCHAR_T_BITS__ == 16
  423. #define WCHAR_MAX 0xffffu
  424. #else
  425. #define WCHAR_MAX 0xffffffffu
  426. #endif
  427. #endif
  428. #ifndef WCHAR_MIN
  429. #define WCHAR_MIN 0
  430. #endif
  431. #if defined(_TMS320C5XX) || defined(__TMS320C55X__) || defined(__MSP430__)
  432. #define WINT_MIN (INT16_MIN)
  433. #define WINT_MAX (INT16_MAX)
  434. #elif defined(__TMS320C2000__) || defined(_TMS320C6X) || defined(__FROZEN__) || \
  435. defined(__ARM_ARCH) || defined(__ARP32__) || defined(__PRU__)
  436. #define WINT_MIN (INT32_MIN)
  437. #define WINT_MAX (INT32_MAX)
  438. #endif
  439. /* 7.18.4.1 Macros for minimum-width integer constants */
  440. /*
  441. There is a defect report filed against the C99 standard concerning how
  442. the (U)INTN_C macros should be implemented. Please refer to --
  443. http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_209.htm
  444. for more information. These macros are implemented according to the
  445. suggestion given at this web site.
  446. */
  447. #define INT8_C(value) ((int_least8_t)(value))
  448. #define UINT8_C(value) ((uint_least8_t)(value))
  449. #define INT16_C(value) ((int_least16_t)(value))
  450. #define UINT16_C(value) ((uint_least16_t)(value))
  451. #define INT32_C(value) ((int_least32_t)(value))
  452. #define UINT32_C(value) ((uint_least32_t)(value))
  453. #if defined(__TMS320C55X__) || \
  454. (defined(_TMS320C6X) && !defined(__C6X_MIGRATION__))
  455. #define INT40_C(value) ((int_least40_t)(value))
  456. #define UINT40_C(value) ((uint_least40_t)(value))
  457. #endif
  458. #if defined(__ARM_ARCH) || defined(_TMS320C6X) || defined(__FROZEN__) || \
  459. defined(__ARP32__) || defined(__MSP430__) || defined(__PRU__)
  460. #define INT64_C(value) ((int_least64_t)(value))
  461. #define UINT64_C(value) ((uint_least64_t)(value))
  462. #elif defined(__TMS320C2000__)
  463. #if defined(__TMS320C28X__) || \
  464. (defined(__TMS320C28XX_CLA__) && defined(__TI_EABI__))
  465. #define INT64_C(value) ((int_least64_t)(value))
  466. #define UINT64_C(value) ((uint_least64_t)(value))
  467. #endif
  468. #endif
  469. /* 7.18.4.2 Macros for greatest-width integer constants */
  470. #define INTMAX_C(value) ((intmax_t)(value))
  471. #define UINTMAX_C(value) ((uintmax_t)(value))
  472. #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
  473. #endif
  474. #endif /* _STDINT_H_ */