From f1f369b6c6257105b20f01ef5a10e38ededac758 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Tue, 2 Jan 2024 19:04:15 +1300 Subject: [PATCH] LibWeb: Add IDL integer typedefs To make it easier to work out what the correctly sized type should be, instead of needing to consult the spec or IDL generator. --- Userland/Libraries/LibWeb/WebIDL/Types.h | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Userland/Libraries/LibWeb/WebIDL/Types.h diff --git a/Userland/Libraries/LibWeb/WebIDL/Types.h b/Userland/Libraries/LibWeb/WebIDL/Types.h new file mode 100644 index 0000000000..79fc6fcef7 --- /dev/null +++ b/Userland/Libraries/LibWeb/WebIDL/Types.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2023, Shannon Booth + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +namespace Web::WebIDL { + +// https://webidl.spec.whatwg.org/#idl-byte +// The byte type is a signed integer type that has values in the range [−128, 127]. +using Byte = i8; + +// https://webidl.spec.whatwg.org/#idl-octet +// The octet type is an unsigned integer type that has values in the range [0, 255]. +using Octet = u8; + +// https://webidl.spec.whatwg.org/#idl-short +// The short type is a signed integer type that has values in the range [−32768, 32767]. +using Short = i16; + +// https://webidl.spec.whatwg.org/#idl-unsigned-short +// The unsigned short type is an unsigned integer type that has values in the range [0, 65535]. +using UnsignedShort = u16; + +// https://webidl.spec.whatwg.org/#idl-long +// The long type is a signed integer type that has values in the range [−2147483648, 2147483647]. +using Long = i32; + +// https://webidl.spec.whatwg.org/#idl-unsigned-long +// The unsigned long type is an unsigned integer type that has values in the range [0, 4294967295]. +using UnsignedLong = u32; + +// https://webidl.spec.whatwg.org/#idl-long-long +// The long long type is a signed integer type that has values in the range [−9223372036854775808, 9223372036854775807]. +using LongLong = i64; + +// https://webidl.spec.whatwg.org/#idl-unsigned-long-long +// The unsigned long long type is an unsigned integer type that has values in the range [0, 18446744073709551615]. +using UnsignedLongLong = u64; + +}