mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Add u8/u16/u32/u64 and i8/i16/i32/i64 typedefs.
These are more explicit and will be immediately understandable unlike the old types which assume that you're in an IA-32 headspace. :^)
This commit is contained in:
parent
83df654904
commit
a190f67450
Notes:
sideshowbarker
2024-07-19 13:24:52 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a190f674501
1 changed files with 28 additions and 0 deletions
28
AK/Types.h
28
AK/Types.h
|
@ -3,6 +3,24 @@
|
|||
#include <AK/IterationDecision.h>
|
||||
|
||||
#ifdef __serenity__
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long long int u64;
|
||||
static_assert(sizeof(u8) == 1);
|
||||
static_assert(sizeof(u16) == 2);
|
||||
static_assert(sizeof(u32) == 4);
|
||||
static_assert(sizeof(u64) == 8);
|
||||
|
||||
typedef signed char i8;
|
||||
typedef signed short i16;
|
||||
typedef signed int i32;
|
||||
typedef signed long long int i64;
|
||||
static_assert(sizeof(i8) == 1);
|
||||
static_assert(sizeof(i16) == 2);
|
||||
static_assert(sizeof(i32) == 4);
|
||||
static_assert(sizeof(i64) == 8);
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int dword;
|
||||
|
@ -35,6 +53,16 @@ typedef signed_qword int64_t;
|
|||
# include <stdint.h>
|
||||
# include <sys/types.h>
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
typedef int8_t i8;
|
||||
typedef int16_t i16;
|
||||
typedef int32_t i32;
|
||||
typedef int64_t i64;
|
||||
|
||||
typedef uint8_t byte;
|
||||
typedef uint16_t word;
|
||||
typedef uint32_t dword;
|
||||
|
|
Loading…
Reference in a new issue