diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-04-25 15:00:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-25 15:00:36 -0400 |
| commit | b5ca6352416995b5edd358623a6ae5db38d5e634 (patch) | |
| tree | 8fa30243c974a18565756956f77045e034a7524d /source/core | |
| parent | c84e7c0fa526de51f380227a6667f723af36aea2 (diff) | |
Feature/uint int definition (#954)
* * Moved CPU determination macros to slang.h
* Determine SlangUInt/SlangInt from the pointer width (determined from CPU macros)
* Removed the UnambiguousInt and UnambigousUInt types - as a previous fragile work around
* Removed UInt/Int definition from smart-pointer.h as now in common.h
* * Remove ambiguity for PrettyWriter and ints
* Improve comment around SlangInt/UInt
* More fixes around ambiguity with PrettyWriter and integral types.
* Disable VK on OSX.
* Force CI to rebuild as spurious error.
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/common.h | 6 | ||||
| -rw-r--r-- | source/core/core.vcxproj | 1 | ||||
| -rw-r--r-- | source/core/core.vcxproj.filters | 3 | ||||
| -rw-r--r-- | source/core/slang-byte-encode-util.h | 2 | ||||
| -rw-r--r-- | source/core/slang-cpu-defines.h | 102 | ||||
| -rw-r--r-- | source/core/smart-pointer.h | 4 |
6 files changed, 6 insertions, 112 deletions
diff --git a/source/core/common.h b/source/core/common.h index 5aa7b7737..ba7cd9836 100644 --- a/source/core/common.h +++ b/source/core/common.h @@ -1,6 +1,8 @@ #ifndef CORE_LIB_COMMON_H #define CORE_LIB_COMMON_H +#include "../../slang.h" + #include <cstdint> #ifdef __GNUC__ @@ -19,6 +21,10 @@ namespace Slang typedef int64_t Int64; typedef uint64_t UInt64; + // Define + typedef SlangUInt UInt; + typedef SlangInt Int; + // typedef unsigned short Word; typedef intptr_t PtrInt; diff --git a/source/core/core.vcxproj b/source/core/core.vcxproj index b89e2acff..4b730f028 100644 --- a/source/core/core.vcxproj +++ b/source/core/core.vcxproj @@ -183,7 +183,6 @@ <ClInclude Include="platform.h" /> <ClInclude Include="secure-crt.h" /> <ClInclude Include="slang-byte-encode-util.h" /> - <ClInclude Include="slang-cpu-defines.h" /> <ClInclude Include="slang-free-list.h" /> <ClInclude Include="slang-io.h" /> <ClInclude Include="slang-math.h" /> diff --git a/source/core/core.vcxproj.filters b/source/core/core.vcxproj.filters index 2faaa7137..e0341df7a 100644 --- a/source/core/core.vcxproj.filters +++ b/source/core/core.vcxproj.filters @@ -48,9 +48,6 @@ <ClInclude Include="slang-byte-encode-util.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="slang-cpu-defines.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="slang-free-list.h"> <Filter>Header Files</Filter> </ClInclude> diff --git a/source/core/slang-byte-encode-util.h b/source/core/slang-byte-encode-util.h index 77ddc2f65..5936cae60 100644 --- a/source/core/slang-byte-encode-util.h +++ b/source/core/slang-byte-encode-util.h @@ -3,8 +3,6 @@ #include "list.h" -#include "slang-cpu-defines.h" - namespace Slang { struct ByteEncodeUtil diff --git a/source/core/slang-cpu-defines.h b/source/core/slang-cpu-defines.h deleted file mode 100644 index 5ad1ecf88..000000000 --- a/source/core/slang-cpu-defines.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef SLANG_CPU_DEFINES_H -#define SLANG_CPU_DEFINES_H - -/* Macros for detecting processor */ -#if defined(_M_ARM) || defined(__ARM_EABI__) -// This is special case for nVidia tegra -# define SLANG_PROCESSOR_ARM 1 -#elif defined(__i386__) || defined(_M_IX86) -# define SLANG_PROCESSOR_X86 1 -#elif defined(_M_AMD64) || defined(_M_X64) || defined(__amd64) || defined(__x86_64) -# define SLANG_PROCESSOR_X86_64 1 -#elif defined(_PPC_) || defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) -# if defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || defined(__64BIT__) || defined(_LP64) || defined(__LP64__) -# define SLANG_PROCESSOR_POWER_PC_64 1 -# else -# define SLANG_PROCESSOR_POWER_PC 1 -# endif -#elif defined(__arm__) -# define SLANG_PROCESSOR_ARM 1 -#elif defined(__aarch64__) -# define SLANG_PROCESSOR_ARM_64 1 -#endif - -#ifndef SLANG_PROCESSOR_ARM -# define SLANG_PROCESSOR_ARM 0 -#endif - -#ifndef SLANG_PROCESSOR_ARM_64 -# define SLANG_PROCESSOR_ARM_64 0 -#endif - -#ifndef SLANG_PROCESSOR_X86 -# define SLANG_PROCESSOR_X86 0 -#endif - -#ifndef SLANG_PROCESSOR_X86_64 -# define SLANG_PROCESSOR_X86_64 0 -#endif - -#ifndef SLANG_PROCESSOR_POWER_PC -# define SLANG_PROCESSOR_POWER_PC 0 -#endif - -#ifndef SLANG_PROCESSOR_POWER_PC_64 -# define SLANG_PROCESSOR_POWER_PC_64 0 -#endif - -// Processor families - -#define SLANG_PROCESSOR_FAMILY_X86 (SLANG_PROCESSOR_X86_64 | SLANG_PROCESSOR_X86) -#define SLANG_PROCESSOR_FAMILY_ARM (SLANG_PROCESSOR_ARM | SLANG_PROCESSOR_ARM_64) -#define SLANG_PROCESSOR_FAMILY_POWER_PC (SLANG_PROCESSOR_POWER_PC_64 | SLANG_PROCESSOR_POWER_PC) - -#define SLANG_PTR_IS_64 (SLANG_PROCESSOR_ARM_64 | SLANG_PROCESSOR_X86_64 | SLANG_PROCESSOR_POWER_PC_64) -#define SLANG_PTR_IS_32 (SLANG_PTR_IS_64 ^ 1) - -// TODO: This isn't great. The problem is UInt maps to size_t, and on some targets (like OSX) -// size_t is distinct from any other integral type. So that creates an ambiguity -// Really we want to modify the StringBuilder and elsewhere to handle the case when it is known it can't unambiguously coerce -namespace Slang { -#ifdef SLANG_PTR_IS_64 -typedef UInt64 UnambigousUInt; -typedef Int64 UnambiguousInt; -#else -typedef UInt32 UnambigousUInt; -typedef Int32 UnambiguousInt; -#endif -} // namespace Slang - -// Processor features -#if SLANG_PROCESSOR_FAMILY_X86 -# define SLANG_LITTLE_ENDIAN 1 -# define SLANG_UNALIGNED_ACCESS 1 -#elif SLANG_PROCESSOR_FAMILY_ARM -# if defined(__ARMEB__) -# define SLANG_BIG_ENDIAN 1 -# else -# define SLANG_LITTLE_ENDIAN 1 -# endif -#elif SLANG_PROCESSOR_FAMILY_POWER_PC -# define SLANG_BIG_ENDIAN 1 -#endif - -#ifndef SLANG_LITTLE_ENDIAN -# define SLANG_LITTLE_ENDIAN 0 -#endif - -#ifndef SLANG_BIG_ENDIAN -# define SLANG_BIG_ENDIAN 0 -#endif - -#ifndef SLANG_UNALIGNED_ACCESS -# define SLANG_UNALIGNED_ACCESS 0 -#endif - -// One endianess must be set -#if ((SLANG_BIG_ENDIAN | SLANG_LITTLE_ENDIAN) == 0) -# error "Couldn't determine endianess" -#endif - - -#endif // SLANG_CPU_DEFINES_H
\ No newline at end of file diff --git a/source/core/smart-pointer.h b/source/core/smart-pointer.h index 0b03deb8f..8ce67e384 100644 --- a/source/core/smart-pointer.h +++ b/source/core/smart-pointer.h @@ -11,10 +11,6 @@ namespace Slang { - // TODO: Need to centralize these typedefs - typedef uintptr_t UInt; - typedef intptr_t Int; - // Base class for all reference-counted objects class RefObject { |
