diff --git a/LibC/inttypes.h b/LibC/inttypes.h index 9a6118bd85..1510aa0920 100644 --- a/LibC/inttypes.h +++ b/LibC/inttypes.h @@ -1 +1,7 @@ +#pragma once + #include + +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" diff --git a/LibC/stdint.h b/LibC/stdint.h index 551bef265c..29af12f654 100644 --- a/LibC/stdint.h +++ b/LibC/stdint.h @@ -4,10 +4,12 @@ __BEGIN_DECLS +typedef unsigned long long int uint64_t; typedef unsigned int uint32_t; typedef unsigned short uint16_t; typedef unsigned char uint8_t; +typedef signed long long int int64_t; typedef signed int int32_t; typedef signed short int16_t; typedef signed char int8_t; diff --git a/LibC/stdlib.cpp b/LibC/stdlib.cpp index 74fcfd9436..7afa23b98a 100644 --- a/LibC/stdlib.cpp +++ b/LibC/stdlib.cpp @@ -267,4 +267,20 @@ int system(const char* command) return execl("/bin/sh", "sh", "-c", command, nullptr); } +div_t div(int numerator, int denominator) +{ + div_t result; + result.quot = numerator / denominator; + result.rem = numerator % denominator; + return result; +} + +ldiv_t ldiv(long numerator, long denominator) +{ + ldiv_t result; + result.quot = numerator / denominator; + result.rem = numerator % denominator; + return result; +} + } diff --git a/LibC/stdlib.h b/LibC/stdlib.h index 26b3a8739d..27f4d2dc81 100644 --- a/LibC/stdlib.h +++ b/LibC/stdlib.h @@ -30,5 +30,10 @@ void srand(unsigned seed); long int random(); void srandom(unsigned seed); +typedef struct { int quot; int rem; } div_t; +div_t div(int, int); +typedef struct { long quot; long rem; } ldiv_t; +ldiv_t ldiv(long, long); + __END_DECLS