Skip to content

Commit

Permalink
Add more stdint types
Browse files Browse the repository at this point in the history
  • Loading branch information
kant2002 committed Sep 20, 2024
1 parent eec3a19 commit 07c5fd5
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Cesium.Compiler/stdlib/stdint.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,33 @@
#define UINT_FAST16_MAX UINT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX

typedef signed char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;

typedef signed char int_least8_t;
typedef short int_least16_t;
typedef int int_least32_t;
typedef long long int_least64_t;
typedef unsigned char uint_least8_t;
typedef unsigned short uint_least16_t;
typedef unsigned int uint_least32_t;
typedef unsigned long long uint_least64_t;

typedef signed char int_fast8_t;
typedef int int_fast16_t;
typedef int int_fast32_t;
typedef long long int_fast64_t;
typedef unsigned char uint_fast8_t;
typedef unsigned int uint_fast16_t;
typedef unsigned int uint_fast32_t;
typedef unsigned long long uint_fast64_t;

typedef long long intmax_t;
typedef unsigned long long uintmax_t;
40 changes: 40 additions & 0 deletions Cesium.IntegrationTests/stdlib/types/integer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <inttypes.h>
#include <stdio.h>

int main(void)
{
printf("%zu\n", sizeof(int8_t));
printf("%zu\n", sizeof(int16_t));
printf("%zu\n", sizeof(int32_t));
printf("%zu\n", sizeof(int64_t));

printf("%zu\n", sizeof(int_fast8_t));
printf("%zu\n", sizeof(int_fast16_t));
printf("%zu\n", sizeof(int_fast32_t));
printf("%zu\n", sizeof(int_fast64_t));

printf("%zu\n", sizeof(int_least8_t));
printf("%zu\n", sizeof(int_least16_t));
printf("%zu\n", sizeof(int_least32_t));
printf("%zu\n", sizeof(int_least64_t));

printf("%zu\n", sizeof(uint8_t));
printf("%zu\n", sizeof(uint16_t));
printf("%zu\n", sizeof(uint32_t));
printf("%zu\n", sizeof(uint64_t));

printf("%zu\n", sizeof(uint_fast8_t));
printf("%zu\n", sizeof(uint_fast16_t));
printf("%zu\n", sizeof(uint_fast32_t));
printf("%zu\n", sizeof(uint_fast64_t));

printf("%zu\n", sizeof(uint_least8_t));
printf("%zu\n", sizeof(uint_least16_t));
printf("%zu\n", sizeof(uint_least32_t));
printf("%zu\n", sizeof(uint_least64_t));

printf("%zu\n", sizeof(intmax_t));
printf("%zu\n", sizeof(intptr_t));
printf("%zu\n", sizeof(uintmax_t));
printf("%zu\n", sizeof(uintptr_t));
}

0 comments on commit 07c5fd5

Please sign in to comment.