Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
Xavier Del Campo Romero | f297dab1f2 | |
Xavier Del Campo Romero | ff52258e15 | |
Xavier Del Campo Romero | c6ded28dce | |
Xavier Del Campo Romero | c157ae7c78 | |
Xavier Del Campo Romero | 2ffa7e5c7b |
|
@ -5,52 +5,20 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long uint64_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 unsigned char uint_fast8_t;
|
||||
typedef unsigned short uint_fast16_t;
|
||||
typedef unsigned int uint_fast32_t;
|
||||
typedef unsigned long long uint_fast64_t;
|
||||
|
||||
typedef unsigned long long uintmax_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef short int16_t;
|
||||
typedef int int32_t;
|
||||
typedef long long int64_t;
|
||||
|
||||
typedef signed char int_least8_t;
|
||||
typedef short int_least16_t;
|
||||
typedef int int_least32_t;
|
||||
typedef long long int_least64_t;
|
||||
|
||||
typedef char int_fast8_t;
|
||||
typedef short int_fast16_t;
|
||||
typedef int int_fast32_t;
|
||||
typedef long long int_fast64_t;
|
||||
|
||||
typedef long long intmax_t;
|
||||
|
||||
typedef long intptr_t;
|
||||
|
||||
#define PRIu8 "hhu"
|
||||
#define PRIu16 "hu"
|
||||
#define PRIu32 "u"
|
||||
#define PRIu64 "llu"
|
||||
|
||||
#define PRIs8 "hhd"
|
||||
#define PRIs16 "hd"
|
||||
#define PRIs32 "d"
|
||||
#define PRIs64 "lld"
|
||||
#define PRId8 "hhd"
|
||||
#define PRId16 "hd"
|
||||
#define PRId32 "d"
|
||||
#define PRId64 "lld"
|
||||
|
||||
#define PRIi8 "hhi"
|
||||
#define PRIi16 "hi"
|
||||
#define PRIi32 "i"
|
||||
#define PRIi64 "lli"
|
||||
|
||||
#define PRIuLEAST8 "hhu"
|
||||
#define PRIuLEAST16 "hu"
|
||||
|
|
|
@ -3,12 +3,47 @@
|
|||
#ifndef _STDINT_H
|
||||
#define _STDINT_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
// Added ifndef or otherwise GCC 4.8 would complain
|
||||
|
||||
#ifndef __PTRDIFF_TYPE__
|
||||
typedef unsigned int ptrdiff_t;
|
||||
#endif
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long uint64_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 unsigned char uint_fast8_t;
|
||||
typedef unsigned short uint_fast16_t;
|
||||
typedef unsigned int uint_fast32_t;
|
||||
typedef unsigned long long uint_fast64_t;
|
||||
|
||||
typedef unsigned long long uintmax_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef short int16_t;
|
||||
typedef int int32_t;
|
||||
typedef long long int64_t;
|
||||
|
||||
typedef signed char int_least8_t;
|
||||
typedef short int_least16_t;
|
||||
typedef int int_least32_t;
|
||||
typedef long long int_least64_t;
|
||||
|
||||
typedef char int_fast8_t;
|
||||
typedef short int_fast16_t;
|
||||
typedef int int_fast32_t;
|
||||
typedef long long int_fast64_t;
|
||||
|
||||
typedef long long intmax_t;
|
||||
|
||||
typedef long intptr_t;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -116,13 +116,15 @@ int vprintf(const char *fmt, va_list ap);
|
|||
|
||||
FILE *fdopen(int fildes, const char *mode);
|
||||
FILE *fopen(const char *path, const char *mode);
|
||||
FILE *freopen(const char *path, const char *mode, FILE *stream);
|
||||
int fclose(FILE *stream);
|
||||
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
|
||||
int fgetc(FILE *f);
|
||||
int ftell(FILE *f);
|
||||
int fseek(FILE *f, int offset, int whence);
|
||||
void rewind(FILE *f);
|
||||
|
||||
int fputs(const char *str, FILE *stream);
|
||||
void clearerr(FILE *stream);
|
||||
|
|
|
@ -420,6 +420,12 @@ int fseek(FILE *f, int offset, int whence)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void rewind(FILE *f)
|
||||
{
|
||||
fseek(f, 0, SEEK_SET);
|
||||
clearerr(f);
|
||||
}
|
||||
|
||||
int toupper(int c)
|
||||
{
|
||||
if(c >= 'a' && c <= 'z')
|
||||
|
@ -716,12 +722,12 @@ int puts(const char *str)
|
|||
return EOF;
|
||||
}
|
||||
|
||||
size_t fwrite(void *restrict const ptr, const size_t size, const size_t nmemb,
|
||||
size_t fwrite(const void *restrict const ptr, const size_t size, const size_t nmemb,
|
||||
FILE *restrict const f)
|
||||
{
|
||||
if(IS_CONS_OUT(f)) // stdout or stderr
|
||||
{
|
||||
char *c = ptr;
|
||||
const char *c = ptr;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < size; i++)
|
||||
|
|
Loading…
Reference in New Issue