From a6032446c6bf7f64d1e201bf438a4c7605a3dbb4 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 15 Sep 2022 14:22:59 -0700 Subject: Language feature: pointer sized int types. (#2401) * Language feature: pointer sized int types. * Fix. * small change to test. * Fix stdlib. * Fix. * Fix. * Add typedef for `size_t` in stdlib. * Fix test. * Add `intptr_t::size` constant. Co-authored-by: Yong He --- source/slang/slang.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index b68dbc14a..f2668b995 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -79,6 +79,8 @@ namespace Slang { { uint8_t(sizeof(float)), BaseTypeInfo::Flag::FloatingPoint , uint8_t(BaseType::Float) }, { uint8_t(sizeof(double)), BaseTypeInfo::Flag::FloatingPoint , uint8_t(BaseType::Double) }, { uint8_t(sizeof(char)), BaseTypeInfo::Flag::Signed | BaseTypeInfo::Flag::Integer , uint8_t(BaseType::Char) }, + { uint8_t(sizeof(intptr_t)), BaseTypeInfo::Flag::Signed | BaseTypeInfo::Flag::Integer , uint8_t(BaseType::IntPtr) }, + { uint8_t(sizeof(uintptr_t)), BaseTypeInfo::Flag::Integer , uint8_t(BaseType::UIntPtr) }, }; /* static */bool BaseTypeInfo::check() @@ -111,6 +113,9 @@ namespace Slang { case BaseType::Half: return UnownedStringSlice::fromLiteral("half"); case BaseType::Float: return UnownedStringSlice::fromLiteral("float"); case BaseType::Double: return UnownedStringSlice::fromLiteral("double"); + case BaseType::Char: return UnownedStringSlice::fromLiteral("char"); + case BaseType::IntPtr: return UnownedStringSlice::fromLiteral("intptr_t"); + case BaseType::UIntPtr: return UnownedStringSlice::fromLiteral("uintptr_t"); default: { SLANG_ASSERT(!"Unknown basic type"); -- cgit v1.2.3