Advertisement
Guest User

code

a guest
Apr 6th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.26 KB | None | 0 0
  1. //
  2. // stdint.h
  3. //
  4. //
  5. // Created by Lili Westtown on 4/4/16.
  6. //
  7. //
  8.  
  9. #ifndef stdint_h
  10. #define stdint_h
  11.  
  12.  
  13. #endif /* stdint_h */
  14.  
  15. /* Copyright (c) 2002,2004,2005 Marek Michalkiewicz
  16. 2 Copyright (c) 2005, Carlos Lamas
  17. 3 Copyright (c) 2005,2007 Joerg Wunsch
  18. 4 Copyright (c) 2013 Embecosm
  19. 5 All rights reserved.
  20. 6
  21. 7 Redistribution and use in source and binary forms, with or without
  22. 8 modification, are permitted provided that the following conditions are met:
  23. 9
  24. 10 * Redistributions of source code must retain the above copyright
  25. 11 notice, this list of conditions and the following disclaimer.
  26. 12
  27. 13 * Redistributions in binary form must reproduce the above copyright
  28. 14 notice, this list of conditions and the following disclaimer in
  29. 15 the documentation and/or other materials provided with the
  30. 16 distribution.
  31. 17
  32. 18 * Neither the name of the copyright holders nor the names of
  33. 19 contributors may be used to endorse or promote products derived
  34. 20 from this software without specific prior written permission.
  35. 21
  36. 22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  37. 23 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  38. 24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  39. 25 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  40. 26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  41. 27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  42. 28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  43. 29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  44. 30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  45. 31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  46. 32 POSSIBILITY OF SUCH DAMAGE. */
  47. 33
  48. 34 /* $Id: stdint_8h_source.html,v 1.1.1.6 2016/02/09 07:13:42 joerg_wunsch Exp $ */
  49. 35
  50. 36 /*
  51. 37 * ISO/IEC 9899:1999 7.18 Integer types <stdint.h>
  52. 38 */
  53. 39
  54. 40 #ifndef __STDINT_H_
  55. 41 #define __STDINT_H_
  56. 42
  57. 43 /** \file */
  58. 44 /** \defgroup avr_stdint <stdint.h>: Standard Integer Types
  59. 45 \code #include <stdint.h> \endcode
  60. 46
  61. 47 Use [u]intN_t if you need exactly N bits.
  62. 48
  63. 49 Since these typedefs are mandated by the C99 standard, they are preferred
  64. 50 over rolling your own typedefs. */
  65. 51
  66. 52 #ifndef __DOXYGEN__
  67. 53 /*
  68. 54 * __USING_MINT8 is defined to 1 if the -mint8 option is in effect.
  69. 55 */
  70. 56 #if __INT_MAX__ == 127
  71. 57 # define __USING_MINT8 1
  72. 58 #else
  73. 59 # define __USING_MINT8 0
  74. 60 #endif
  75. 61
  76. 62 #endif /* !__DOXYGEN__ */
  77. 63
  78. 64 /* Integer types */
  79. 65
  80. 66 #if defined(__DOXYGEN__)
  81. 67
  82. 68 /* doxygen gets confused by the __attribute__ stuff */
  83. 69
  84. 70 /** \name Exact-width integer types
  85. 71 Integer types having exactly the specified width */
  86. 72
  87. 73 /*@{*/
  88. 74
  89. 75 /** \ingroup avr_stdint
  90. 76 8-bit signed type. */
  91. 77
  92. 78 typedef signed char int8_t;
  93. 79
  94. 80 /** \ingroup avr_stdint
  95. 81 8-bit unsigned type. */
  96. 82
  97. 83 typedef unsigned char uint8_t;
  98. 84
  99. 85 /** \ingroup avr_stdint
  100. 86 16-bit signed type. */
  101. 87
  102. 88 typedef signed int int16_t;
  103. 89
  104. 90 /** \ingroup avr_stdint
  105. 91 16-bit unsigned type. */
  106. 92
  107. 93 typedef unsigned int uint16_t;
  108. 94
  109. 95 /** \ingroup avr_stdint
  110. 96 32-bit signed type. */
  111. 97
  112. 98 typedef signed long int int32_t;
  113. 99
  114. 100 /** \ingroup avr_stdint
  115. 101 32-bit unsigned type. */
  116. 102
  117. 103 typedef unsigned long int uint32_t;
  118. 104
  119. 105 /** \ingroup avr_stdint
  120. 106 64-bit signed type.
  121. 107 \note This type is not available when the compiler
  122. 108 option -mint8 is in effect. */
  123. 109
  124. 110 typedef signed long long int int64_t;
  125. 111
  126. 112 /** \ingroup avr_stdint
  127. 113 64-bit unsigned type.
  128. 114 \note This type is not available when the compiler
  129. 115 option -mint8 is in effect. */
  130. 116
  131. 117 typedef unsigned long long int uint64_t;
  132. 118
  133. 119 /*@}*/
  134. 120
  135. 121 #else /* !defined(__DOXYGEN__) */
  136. 122
  137. 123 /* actual implementation goes here */
  138. 124
  139. 125 typedef signed int int8_t __attribute__((__mode__(__QI__)));
  140. 126 typedef unsigned int uint8_t __attribute__((__mode__(__QI__)));
  141. 127 typedef signed int int16_t __attribute__ ((__mode__ (__HI__)));
  142. 128 typedef unsigned int uint16_t __attribute__ ((__mode__ (__HI__)));
  143. 129 typedef signed int int32_t __attribute__ ((__mode__ (__SI__)));
  144. 130 typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));
  145. 131 #if !__USING_MINT8
  146. 132 typedef signed int int64_t __attribute__((__mode__(__DI__)));
  147. 133 typedef unsigned int uint64_t __attribute__((__mode__(__DI__)));
  148. 134 #endif
  149. 135
  150. 136 #endif /* defined(__DOXYGEN__) */
  151. 137
  152. 138 /** \name Integer types capable of holding object pointers
  153. 139 These allow you to declare variables of the same size as a pointer. */
  154. 140
  155. 141 /*@{*/
  156. 142
  157. 143 /** \ingroup avr_stdint
  158. 144 Signed pointer compatible type. */
  159. 145
  160. 146 typedef int16_t intptr_t;
  161. 147
  162. 148 /** \ingroup avr_stdint
  163. 149 Unsigned pointer compatible type. */
  164. 150
  165. 151 typedef uint16_t uintptr_t;
  166. 152
  167. 153 /*@}*/
  168. 154
  169. 155 /** \name Minimum-width integer types
  170. 156 Integer types having at least the specified width */
  171. 157
  172. 158 /*@{*/
  173. 159
  174. 160 /** \ingroup avr_stdint
  175. 161 signed int with at least 8 bits. */
  176. 162
  177. 163 typedef int8_t int_least8_t;
  178. 164
  179. 165 /** \ingroup avr_stdint
  180. 166 unsigned int with at least 8 bits. */
  181. 167
  182. 168 typedef uint8_t uint_least8_t;
  183. 169
  184. 170 /** \ingroup avr_stdint
  185. 171 signed int with at least 16 bits. */
  186. 172
  187. 173 typedef int16_t int_least16_t;
  188. 174
  189. 175 /** \ingroup avr_stdint
  190. 176 unsigned int with at least 16 bits. */
  191. 177
  192. 178 typedef uint16_t uint_least16_t;
  193. 179
  194. 180 /** \ingroup avr_stdint
  195. 181 signed int with at least 32 bits. */
  196. 182
  197. 183 typedef int32_t int_least32_t;
  198. 184
  199. 185 /** \ingroup avr_stdint
  200. 186 unsigned int with at least 32 bits. */
  201. 187
  202. 188 typedef uint32_t uint_least32_t;
  203. 189
  204. 190 #if !__USING_MINT8 || defined(__DOXYGEN__)
  205. 191 /** \ingroup avr_stdint
  206. 192 signed int with at least 64 bits.
  207. 193 \note This type is not available when the compiler
  208. 194 option -mint8 is in effect. */
  209. 195
  210. 196 typedef int64_t int_least64_t;
  211. 197
  212. 198 /** \ingroup avr_stdint
  213. 199 unsigned int with at least 64 bits.
  214. 200 \note This type is not available when the compiler
  215. 201 option -mint8 is in effect. */
  216. 202
  217. 203 typedef uint64_t uint_least64_t;
  218. 204 #endif
  219. 205
  220. 206 /*@}*/
  221. 207
  222. 208
  223. 209 /** \name Fastest minimum-width integer types
  224. 210 Integer types being usually fastest having at least the specified width */
  225. 211
  226. 212 /*@{*/
  227. 213
  228. 214 /** \ingroup avr_stdint
  229. 215 fastest signed int with at least 8 bits. */
  230. 216
  231. 217 typedef int8_t int_fast8_t;
  232. 218
  233. 219 /** \ingroup avr_stdint
  234. 220 fastest unsigned int with at least 8 bits. */
  235. 221
  236. 222 typedef uint8_t uint_fast8_t;
  237. 223
  238. 224 /** \ingroup avr_stdint
  239. 225 fastest signed int with at least 16 bits. */
  240. 226
  241. 227 typedef int16_t int_fast16_t;
  242. 228
  243. 229 /** \ingroup avr_stdint
  244. 230 fastest unsigned int with at least 16 bits. */
  245. 231
  246. 232 typedef uint16_t uint_fast16_t;
  247. 233
  248. 234 /** \ingroup avr_stdint
  249. 235 fastest signed int with at least 32 bits. */
  250. 236
  251. 237 typedef int32_t int_fast32_t;
  252. 238
  253. 239 /** \ingroup avr_stdint
  254. 240 fastest unsigned int with at least 32 bits. */
  255. 241
  256. 242 typedef uint32_t uint_fast32_t;
  257. 243
  258. 244 #if !__USING_MINT8 || defined(__DOXYGEN__)
  259. 245 /** \ingroup avr_stdint
  260. 246 fastest signed int with at least 64 bits.
  261. 247 \note This type is not available when the compiler
  262. 248 option -mint8 is in effect. */
  263. 249
  264. 250 typedef int64_t int_fast64_t;
  265. 251
  266. 252 /** \ingroup avr_stdint
  267. 253 fastest unsigned int with at least 64 bits.
  268. 254 \note This type is not available when the compiler
  269. 255 option -mint8 is in effect. */
  270. 256
  271. 257 typedef uint64_t uint_fast64_t;
  272. 258 #endif
  273. 259
  274. 260 /*@}*/
  275. 261
  276. 262
  277. 263 /** \name Greatest-width integer types
  278. 264 Types designating integer data capable of representing any value of
  279. 265 any integer type in the corresponding signed or unsigned category */
  280. 266
  281. 267 /*@{*/
  282. 268
  283. 269 #if __USING_MINT8
  284. 270 typedef int32_t intmax_t;
  285. 271
  286. 272 typedef uint32_t uintmax_t;
  287. 273 #else /* !__USING_MINT8 */
  288. 274 /** \ingroup avr_stdint
  289. 275 largest signed int available. */
  290. 276
  291. 277 typedef int64_t intmax_t;
  292. 278
  293. 279 /** \ingroup avr_stdint
  294. 280 largest unsigned int available. */
  295. 281
  296. 282 typedef uint64_t uintmax_t;
  297. 283 #endif /* __USING_MINT8 */
  298. 284
  299. 285 /*@}*/
  300. 286
  301. 287 #ifndef __DOXYGEN__
  302. 288 /* Helping macro */
  303. 289 #ifndef __CONCAT
  304. 290 #define __CONCATenate(left, right) left ## right
  305. 291 #define __CONCAT(left, right) __CONCATenate(left, right)
  306. 292 #endif
  307. 293
  308. 294 #endif /* !__DOXYGEN__ */
  309. 295
  310. 296 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
  311. 297
  312. 298 /** \name Limits of specified-width integer types
  313. 299 C++ implementations should define these macros only when
  314. 300 __STDC_LIMIT_MACROS is defined before <stdint.h> is included */
  315. 301
  316. 302 /*@{*/
  317. 303
  318. 304 /** \ingroup avr_stdint
  319. 305 largest positive value an int8_t can hold. */
  320. 306
  321. 307 #define INT8_MAX 0x7f
  322. 308
  323. 309 /** \ingroup avr_stdint
  324. 310 smallest negative value an int8_t can hold. */
  325. 311
  326. 312 #define INT8_MIN (-INT8_MAX - 1)
  327. 313
  328. 314 #if __USING_MINT8
  329. 315
  330. 316 #define UINT8_MAX (__CONCAT(INT8_MAX, U) * 2U + 1U)
  331. 317
  332. 318 #define INT16_MAX 0x7fffL
  333. 319 #define INT16_MIN (-INT16_MAX - 1L)
  334. 320 #define UINT16_MAX (__CONCAT(INT16_MAX, U) * 2UL + 1UL)
  335. 321
  336. 322 #define INT32_MAX 0x7fffffffLL
  337. 323 #define INT32_MIN (-INT32_MAX - 1LL)
  338. 324 #define UINT32_MAX (__CONCAT(INT32_MAX, U) * 2ULL + 1ULL)
  339. 325
  340. 326 #else /* !__USING_MINT8 */
  341. 327
  342. 328 /** \ingroup avr_stdint
  343. 329 largest value an uint8_t can hold. */
  344. 330
  345. 331 #define UINT8_MAX (INT8_MAX * 2 + 1)
  346. 332
  347. 333 /** \ingroup avr_stdint
  348. 334 largest positive value an int16_t can hold. */
  349. 335
  350. 336 #define INT16_MAX 0x7fff
  351. 337
  352. 338 /** \ingroup avr_stdint
  353. 339 smallest negative value an int16_t can hold. */
  354. 340
  355. 341 #define INT16_MIN (-INT16_MAX - 1)
  356. 342
  357. 343 /** \ingroup avr_stdint
  358. 344 largest value an uint16_t can hold. */
  359. 345
  360. 346 #define UINT16_MAX (__CONCAT(INT16_MAX, U) * 2U + 1U)
  361. 347
  362. 348 /** \ingroup avr_stdint
  363. 349 largest positive value an int32_t can hold. */
  364. 350
  365. 351 #define INT32_MAX 0x7fffffffL
  366. 352
  367. 353 /** \ingroup avr_stdint
  368. 354 smallest negative value an int32_t can hold. */
  369. 355
  370. 356 #define INT32_MIN (-INT32_MAX - 1L)
  371. 357
  372. 358 /** \ingroup avr_stdint
  373. 359 largest value an uint32_t can hold. */
  374. 360
  375. 361 #define UINT32_MAX (__CONCAT(INT32_MAX, U) * 2UL + 1UL)
  376. 362
  377. 363 #endif /* __USING_MINT8 */
  378. 364
  379. 365 /** \ingroup avr_stdint
  380. 366 largest positive value an int64_t can hold. */
  381. 367
  382. 368 #define INT64_MAX 0x7fffffffffffffffLL
  383. 369
  384. 370 /** \ingroup avr_stdint
  385. 371 smallest negative value an int64_t can hold. */
  386. 372
  387. 373 #define INT64_MIN (-INT64_MAX - 1LL)
  388. 374
  389. 375 /** \ingroup avr_stdint
  390. 376 largest value an uint64_t can hold. */
  391. 377
  392. 378 #define UINT64_MAX (__CONCAT(INT64_MAX, U) * 2ULL + 1ULL)
  393. 379
  394. 380 /*@}*/
  395. 381
  396. 382 /** \name Limits of minimum-width integer types */
  397. 383 /*@{*/
  398. 384
  399. 385 /** \ingroup avr_stdint
  400. 386 largest positive value an int_least8_t can hold. */
  401. 387
  402. 388 #define INT_LEAST8_MAX INT8_MAX
  403. 389
  404. 390 /** \ingroup avr_stdint
  405. 391 smallest negative value an int_least8_t can hold. */
  406. 392
  407. 393 #define INT_LEAST8_MIN INT8_MIN
  408. 394
  409. 395 /** \ingroup avr_stdint
  410. 396 largest value an uint_least8_t can hold. */
  411. 397
  412. 398 #define UINT_LEAST8_MAX UINT8_MAX
  413. 399
  414. 400 /** \ingroup avr_stdint
  415. 401 largest positive value an int_least16_t can hold. */
  416. 402
  417. 403 #define INT_LEAST16_MAX INT16_MAX
  418. 404
  419. 405 /** \ingroup avr_stdint
  420. 406 smallest negative value an int_least16_t can hold. */
  421. 407
  422. 408 #define INT_LEAST16_MIN INT16_MIN
  423. 409
  424. 410 /** \ingroup avr_stdint
  425. 411 largest value an uint_least16_t can hold. */
  426. 412
  427. 413 #define UINT_LEAST16_MAX UINT16_MAX
  428. 414
  429. 415 /** \ingroup avr_stdint
  430. 416 largest positive value an int_least32_t can hold. */
  431. 417
  432. 418 #define INT_LEAST32_MAX INT32_MAX
  433. 419
  434. 420 /** \ingroup avr_stdint
  435. 421 smallest negative value an int_least32_t can hold. */
  436. 422
  437. 423 #define INT_LEAST32_MIN INT32_MIN
  438. 424
  439. 425 /** \ingroup avr_stdint
  440. 426 largest value an uint_least32_t can hold. */
  441. 427
  442. 428 #define UINT_LEAST32_MAX UINT32_MAX
  443. 429
  444. 430 /** \ingroup avr_stdint
  445. 431 largest positive value an int_least64_t can hold. */
  446. 432
  447. 433 #define INT_LEAST64_MAX INT64_MAX
  448. 434
  449. 435 /** \ingroup avr_stdint
  450. 436 smallest negative value an int_least64_t can hold. */
  451. 437
  452. 438 #define INT_LEAST64_MIN INT64_MIN
  453. 439
  454. 440 /** \ingroup avr_stdint
  455. 441 largest value an uint_least64_t can hold. */
  456. 442
  457. 443 #define UINT_LEAST64_MAX UINT64_MAX
  458. 444
  459. 445 /*@}*/
  460. 446
  461. 447 /** \name Limits of fastest minimum-width integer types */
  462. 448
  463. 449 /*@{*/
  464. 450
  465. 451 /** \ingroup avr_stdint
  466. 452 largest positive value an int_fast8_t can hold. */
  467. 453
  468. 454 #define INT_FAST8_MAX INT8_MAX
  469. 455
  470. 456 /** \ingroup avr_stdint
  471. 457 smallest negative value an int_fast8_t can hold. */
  472. 458
  473. 459 #define INT_FAST8_MIN INT8_MIN
  474. 460
  475. 461 /** \ingroup avr_stdint
  476. 462 largest value an uint_fast8_t can hold. */
  477. 463
  478. 464 #define UINT_FAST8_MAX UINT8_MAX
  479. 465
  480. 466 /** \ingroup avr_stdint
  481. 467 largest positive value an int_fast16_t can hold. */
  482. 468
  483. 469 #define INT_FAST16_MAX INT16_MAX
  484. 470
  485. 471 /** \ingroup avr_stdint
  486. 472 smallest negative value an int_fast16_t can hold. */
  487. 473
  488. 474 #define INT_FAST16_MIN INT16_MIN
  489. 475
  490. 476 /** \ingroup avr_stdint
  491. 477 largest value an uint_fast16_t can hold. */
  492. 478
  493. 479 #define UINT_FAST16_MAX UINT16_MAX
  494. 480
  495. 481 /** \ingroup avr_stdint
  496. 482 largest positive value an int_fast32_t can hold. */
  497. 483
  498. 484 #define INT_FAST32_MAX INT32_MAX
  499. 485
  500. 486 /** \ingroup avr_stdint
  501. 487 smallest negative value an int_fast32_t can hold. */
  502. 488
  503. 489 #define INT_FAST32_MIN INT32_MIN
  504. 490
  505. 491 /** \ingroup avr_stdint
  506. 492 largest value an uint_fast32_t can hold. */
  507. 493
  508. 494 #define UINT_FAST32_MAX UINT32_MAX
  509. 495
  510. 496 /** \ingroup avr_stdint
  511. 497 largest positive value an int_fast64_t can hold. */
  512. 498
  513. 499 #define INT_FAST64_MAX INT64_MAX
  514. 500
  515. 501 /** \ingroup avr_stdint
  516. 502 smallest negative value an int_fast64_t can hold. */
  517. 503
  518. 504 #define INT_FAST64_MIN INT64_MIN
  519. 505
  520. 506 /** \ingroup avr_stdint
  521. 507 largest value an uint_fast64_t can hold. */
  522. 508
  523. 509 #define UINT_FAST64_MAX UINT64_MAX
  524. 510
  525. 511 /*@}*/
  526. 512
  527. 513 /** \name Limits of integer types capable of holding object pointers */
  528. 514
  529. 515 /*@{*/
  530. 516
  531. 517 /** \ingroup avr_stdint
  532. 518 largest positive value an intptr_t can hold. */
  533. 519
  534. 520 #define INTPTR_MAX INT16_MAX
  535. 521
  536. 522 /** \ingroup avr_stdint
  537. 523 smallest negative value an intptr_t can hold. */
  538. 524
  539. 525 #define INTPTR_MIN INT16_MIN
  540. 526
  541. 527 /** \ingroup avr_stdint
  542. 528 largest value an uintptr_t can hold. */
  543. 529
  544. 530 #define UINTPTR_MAX UINT16_MAX
  545. 531
  546. 532 /*@}*/
  547. 533
  548. 534 /** \name Limits of greatest-width integer types */
  549. 535
  550. 536 /*@{*/
  551. 537
  552. 538 /** \ingroup avr_stdint
  553. 539 largest positive value an intmax_t can hold. */
  554. 540
  555. 541 #define INTMAX_MAX INT64_MAX
  556. 542
  557. 543 /** \ingroup avr_stdint
  558. 544 smallest negative value an intmax_t can hold. */
  559. 545
  560. 546 #define INTMAX_MIN INT64_MIN
  561. 547
  562. 548 /** \ingroup avr_stdint
  563. 549 largest value an uintmax_t can hold. */
  564. 550
  565. 551 #define UINTMAX_MAX UINT64_MAX
  566. 552
  567. 553 /*@}*/
  568. 554
  569. 555 /** \name Limits of other integer types
  570. 556 C++ implementations should define these macros only when
  571. 557 __STDC_LIMIT_MACROS is defined before <stdint.h> is included */
  572. 558
  573. 559 /*@{*/
  574. 560
  575. 561 /** \ingroup avr_stdint
  576. 562 largest positive value a ptrdiff_t can hold. */
  577. 563
  578. 564 #define PTRDIFF_MAX INT16_MAX
  579. 565
  580. 566 /** \ingroup avr_stdint
  581. 567 smallest negative value a ptrdiff_t can hold. */
  582. 568
  583. 569 #define PTRDIFF_MIN INT16_MIN
  584. 570
  585. 571
  586. 572 /* Limits of sig_atomic_t */
  587. 573 /* signal.h is currently not implemented (not avr/signal.h) */
  588. 574
  589. 575 /** \ingroup avr_stdint
  590. 576 largest positive value a sig_atomic_t can hold. */
  591. 577
  592. 578 #define SIG_ATOMIC_MAX INT8_MAX
  593. 579
  594. 580 /** \ingroup avr_stdint
  595. 581 smallest negative value a sig_atomic_t can hold. */
  596. 582
  597. 583 #define SIG_ATOMIC_MIN INT8_MIN
  598. 584
  599. 585
  600. 586 /** \ingroup avr_stdint
  601. 587 largest value a size_t can hold. */
  602. 588
  603. 589 #define SIZE_MAX UINT16_MAX
  604. 590
  605. 591
  606. 592 /* Limits of wchar_t */
  607. 593 /* wchar.h is currently not implemented */
  608. 594 /* #define WCHAR_MAX */
  609. 595 /* #define WCHAR_MIN */
  610. 596
  611. 597
  612. 598 /* Limits of wint_t */
  613. 599 /* wchar.h is currently not implemented */
  614. 600 #ifndef WCHAR_MAX
  615. 601 #define WCHAR_MAX __WCHAR_MAX__
  616. 602 #define WCHAR_MIN __WCHAR_MIN__
  617. 603 #endif
  618. 604 #ifndef WINT_MAX
  619. 605 #define WINT_MAX __WINT_MAX__
  620. 606 #define WINT_MIN __WINT_MIN__
  621. 607 #endif
  622. 608
  623. 609
  624. 610 #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
  625. 611
  626. 612 #if (!defined __cplusplus || __cplusplus >= 201103L \
  627. 613 || defined __STDC_CONSTANT_MACROS)
  628. 614
  629. 615 /** \name Macros for integer constants
  630. 616 C++ implementations should define these macros only when
  631. 617 __STDC_CONSTANT_MACROS is defined before <stdint.h> is included.
  632. 618
  633. 619 These definitions are valid for integer constants without suffix and
  634. 620 for macros defined as integer constant without suffix */
  635. 621
  636. 622 /* The GNU C preprocessor defines special macros in the implementation
  637. 623 namespace to allow a definition that works in #if expressions. */
  638. 624 #ifdef __INT8_C
  639. 625 #define INT8_C(c) __INT8_C(c)
  640. 626 #define INT16_C(c) __INT16_C(c)
  641. 627 #define INT32_C(c) __INT32_C(c)
  642. 628 #define INT64_C(c) __INT64_C(c)
  643. 629 #define UINT8_C(c) __UINT8_C(c)
  644. 630 #define UINT16_C(c) __UINT16_C(c)
  645. 631 #define UINT32_C(c) __UINT32_C(c)
  646. 632 #define UINT64_C(c) __UINT64_C(c)
  647. 633 #define INTMAX_C(c) __INTMAX_C(c)
  648. 634 #define UINTMAX_C(c) __UINTMAX_C(c)
  649. 635 #else
  650. 636 /** \ingroup avr_stdint
  651. 637 define a constant of type int8_t */
  652. 638
  653. 639 #define INT8_C(value) ((int8_t) value)
  654. 640
  655. 641 /** \ingroup avr_stdint
  656. 642 define a constant of type uint8_t */
  657. 643
  658. 644 #define UINT8_C(value) ((uint8_t) __CONCAT(value, U))
  659. 645
  660. 646 #if __USING_MINT8
  661. 647
  662. 648 #define INT16_C(value) __CONCAT(value, L)
  663. 649 #define UINT16_C(value) __CONCAT(value, UL)
  664. 650
  665. 651 #define INT32_C(value) ((int32_t) __CONCAT(value, LL))
  666. 652 #define UINT32_C(value) ((uint32_t) __CONCAT(value, ULL))
  667. 653
  668. 654 #else /* !__USING_MINT8 */
  669. 655
  670. 656 /** \ingroup avr_stdint
  671. 657 define a constant of type int16_t */
  672. 658
  673. 659 #define INT16_C(value) value
  674. 660
  675. 661 /** \ingroup avr_stdint
  676. 662 define a constant of type uint16_t */
  677. 663
  678. 664 #define UINT16_C(value) __CONCAT(value, U)
  679. 665
  680. 666 /** \ingroup avr_stdint
  681. 667 define a constant of type int32_t */
  682. 668
  683. 669 #define INT32_C(value) __CONCAT(value, L)
  684. 670
  685. 671 /** \ingroup avr_stdint
  686. 672 define a constant of type uint32_t */
  687. 673
  688. 674 #define UINT32_C(value) __CONCAT(value, UL)
  689. 675
  690. 676 #endif /* __USING_MINT8 */
  691. 677
  692. 678 /** \ingroup avr_stdint
  693. 679 define a constant of type int64_t */
  694. 680
  695. 681 #define INT64_C(value) __CONCAT(value, LL)
  696. 682
  697. 683 /** \ingroup avr_stdint
  698. 684 define a constant of type uint64_t */
  699. 685
  700. 686 #define UINT64_C(value) __CONCAT(value, ULL)
  701. 687
  702. 688 /** \ingroup avr_stdint
  703. 689 define a constant of type intmax_t */
  704. 690
  705. 691 #define INTMAX_C(value) __CONCAT(value, LL)
  706. 692
  707. 693 /** \ingroup avr_stdint
  708. 694 define a constant of type uintmax_t */
  709. 695
  710. 696 #define UINTMAX_C(value) __CONCAT(value, ULL)
  711. 697
  712. 698 #endif /* !__INT8_C */
  713. 699
  714. 700 /*@}*/
  715. 701
  716. 702 #endif /* (!defined __cplusplus || __cplusplus >= 201103L \
  717. 703 || defined __STDC_CONSTANT_MACROS) */
  718. 704
  719. 705
  720. 706 #endif /* _STDINT_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement