<PlatformTarget>x64</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<BaseAddress>0x180000000</BaseAddress>
- <DefineConstants>WIN64;AMD64;$(DefineConstants)</DefineConstants>
+ <DefineConstants>BIT64;AMD64;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'x86'">
<PlatformTarget>x86</PlatformTarget>
<BaseAddress>0x10000000</BaseAddress>
- <DefineConstants>WIN32;$(DefineConstants)</DefineConstants>
+ <DefineConstants>BIT32;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'arm'">
<PlatformTarget>arm</PlatformTarget>
- <DefineConstants>WIN32;ARM;$(DefineConstants)</DefineConstants>
+ <DefineConstants>BIT32;ARM;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'arm64'">
<PlatformTarget>AnyCPU</PlatformTarget>
- <DefineConstants>WIN64;ARM64;$(DefineConstants)</DefineConstants>
+ <DefineConstants>BIT64;ARM64;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<!-- Configuration specific properties -->
#endif
}
-#if WIN32
+#if !BIT64 // 32
[SecuritySafeCritical]
#endif
internal static bool CorrectnessEnabled()
{
-#if WIN32
+#if BIT64
+ return false;
+#else // 32
if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
return false;
if (!m_registryChecked)
CheckRegistry();
return m_correctnessWarnings;
-#else
- return false;
-#endif // WIN32
+#endif // BIT64
}
// Whether SafeHandles include a stack trace showing where they
// This method has different signature for x64 and other platforms and is done for performance reasons.
[System.Security.SecurityCritical]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
-#if WIN64
+#if BIT64
internal unsafe static void Memmove(byte* dest, byte* src, ulong len)
#else
internal unsafe static void Memmove(byte* dest, byte* src, uint len)
{
// P/Invoke into the native version when the buffers are overlapping and the copy needs to be performed backwards
// This check can produce false positives for lengths greater than Int32.MaxInt. It is fine because we want to use PInvoke path for the large lengths anyway.
-#if WIN64
+#if BIT64
if ((ulong)dest - (ulong)src < len) goto PInvoke;
#else
if (((uint)dest - (uint)src) < len) goto PInvoke;
*(dest + 6) = *(src + 6);
return;
case 8:
-#if WIN64
+#if BIT64
*(long*)dest = *(long*)src;
#else
*(int*)dest = *(int*)src;
#endif
return;
case 9:
-#if WIN64
+#if BIT64
*(long*)dest = *(long*)src;
#else
*(int*)dest = *(int*)src;
*(dest + 8) = *(src + 8);
return;
case 10:
-#if WIN64
+#if BIT64
*(long*)dest = *(long*)src;
#else
*(int*)dest = *(int*)src;
*(short*)(dest + 8) = *(short*)(src + 8);
return;
case 11:
-#if WIN64
+#if BIT64
*(long*)dest = *(long*)src;
#else
*(int*)dest = *(int*)src;
*(dest + 10) = *(src + 10);
return;
case 12:
-#if WIN64
+#if BIT64
*(long*)dest = *(long*)src;
#else
*(int*)dest = *(int*)src;
*(int*)(dest + 8) = *(int*)(src + 8);
return;
case 13:
-#if WIN64
+#if BIT64
*(long*)dest = *(long*)src;
#else
*(int*)dest = *(int*)src;
*(dest + 12) = *(src + 12);
return;
case 14:
-#if WIN64
+#if BIT64
*(long*)dest = *(long*)src;
#else
*(int*)dest = *(int*)src;
*(short*)(dest + 12) = *(short*)(src + 12);
return;
case 15:
-#if WIN64
+#if BIT64
*(long*)dest = *(long*)src;
#else
*(int*)dest = *(int*)src;
*(dest + 14) = *(src + 14);
return;
case 16:
-#if WIN64
+#if BIT64
*(long*)dest = *(long*)src;
*(long*)(dest + 8) = *(long*)(src + 8);
#else
Aligned: ;
}
-#if WIN64
+#if BIT64
if (((int)dest & 4) != 0)
{
*(int *)dest = *(int *)src;
}
#endif
-#if WIN64
+#if BIT64
ulong count = len / 16;
#else
uint count = len / 16;
#endif
while (count > 0)
{
-#if WIN64
+#if BIT64
((long*)dest)[0] = ((long*)src)[0];
((long*)dest)[1] = ((long*)src)[1];
#else
if ((len & 8) != 0)
{
-#if WIN64
+#if BIT64
((long*)dest)[0] = ((long*)src)[0];
#else
((int*)dest)[0] = ((int*)src)[0];
[SecurityCritical]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute(MethodImplOptions.NoInlining)]
-#if WIN64
+#if BIT64
private unsafe static void _Memmove(byte* dest, byte* src, ulong len)
#else
private unsafe static void _Memmove(byte* dest, byte* src, uint len)
[SuppressUnmanagedCodeSecurity]
[SecurityCritical]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
-#if WIN64
+#if BIT64
extern private unsafe static void __Memmove(byte* dest, byte* src, ulong len);
#else
extern private unsafe static void __Memmove(byte* dest, byte* src, uint len);
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.sourceBytesToCopy);
}
-#if WIN64
+#if BIT64
Memmove((byte*)destination, (byte*)source, checked((ulong) sourceBytesToCopy));
#else
Memmove((byte*)destination, (byte*)source, checked((uint)sourceBytesToCopy));
-#endif // WIN64
+#endif // BIT64
}
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.sourceBytesToCopy);
}
-#if WIN64
+#if BIT64
Memmove((byte*)destination, (byte*)source, sourceBytesToCopy);
#else
Memmove((byte*)destination, (byte*)source, checked((uint)sourceBytesToCopy));
-#endif // WIN64
+#endif // BIT64
}
}
}
public static bool Is64BitProcess {
get {
-#if WIN32
- return false;
-#else
+#if BIT64
return true;
+#else // 32
+ return false;
#endif
}
}
public static bool Is64BitOperatingSystem {
[System.Security.SecuritySafeCritical]
get {
-#if WIN32
+#if BIT64
+ // 64-bit programs run only on 64-bit
+ return true;
+#else // 32
bool isWow64; // WinXP SP2+ and Win2k3 SP1+
return Win32Native.DoesWin32MethodExist(Win32Native.KERNEL32, "IsWow64Process")
&& Win32Native.IsWow64Process(Win32Native.GetCurrentProcess(), out isWow64)
&& isWow64;
-#else
- // 64-bit programs run only on 64-bit
- return true;
#endif
}
}
index = s_pNumericLevel1Index[index + ((ch >> 4) & 0x000f)];
byte* pBytePtr = (byte*)&(s_pNumericLevel1Index[index]);
// Get the result from the 0 -3 bit of ch.
-#if WIN64
+#if BIT64
// To get around the IA64 alignment issue. Our double data is aligned in 8-byte boundary, but loader loads the embeded table starting
// at 4-byte boundary. This cause a alignment issue since double is 8-byte.
byte* pSourcePtr = &(s_pNumericValues[pBytePtr[(ch & 0x000f)] * sizeof(double)]);
Contract.EndContractBlock();
if (!CanSeek) __Error.StreamIsClosed();
-#if WIN32
+#if !BIT64
unsafe {
// On 32 bit machines, ensure we don't wrap around.
if (value > (long) Int32.MaxValue || _mem + value < _mem)
[System.Runtime.Versioning.NonVersionable]
public unsafe IntPtr(int value)
{
- #if WIN32
- m_value = (void *)value;
- #else
+ #if BIT64
m_value = (void *)(long)value;
+ #else // !BIT64 (32)
+ m_value = (void *)value;
#endif
}
[System.Runtime.Versioning.NonVersionable]
public unsafe IntPtr(long value)
{
- #if WIN32
- m_value = (void *)checked((int)value);
- #else
+ #if BIT64
m_value = (void *)value;
+ #else // !BIT64 (32)
+ m_value = (void *)checked((int)value);
#endif
}
throw new ArgumentNullException("info");
}
Contract.EndContractBlock();
- #if WIN32
- info.AddValue("value", (long)((int)m_value));
- #else
+ #if BIT64
info.AddValue("value", (long)(m_value));
+ #else // !BIT64 (32)
+ info.AddValue("value", (long)((int)m_value));
#endif
}
#endif
[System.Security.SecuritySafeCritical] // auto-generated
public unsafe override int GetHashCode() {
#if FEATURE_CORECLR
- #if WIN32
- return unchecked((int)m_value);
- #else
+ #if BIT64
long l = (long)m_value;
return (unchecked((int)l) ^ (int)(l >> 32));
+ #else // !BIT64 (32)
+ return unchecked((int)m_value);
#endif
#else
return unchecked((int)((long)m_value));
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[System.Runtime.Versioning.NonVersionable]
public unsafe int ToInt32() {
- #if WIN32
- return (int)m_value;
- #else
+ #if BIT64
long l = (long)m_value;
return checked((int)l);
+ #else // !BIT64 (32)
+ return (int)m_value;
#endif
}
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[System.Runtime.Versioning.NonVersionable]
public unsafe long ToInt64() {
- #if WIN32
- return (long)(int)m_value;
- #else
+ #if BIT64
return (long)m_value;
+ #else // !BIT64 (32)
+ return (long)(int)m_value;
#endif
}
[System.Security.SecuritySafeCritical] // auto-generated
public unsafe override String ToString() {
- #if WIN32
- return ((int)m_value).ToString(CultureInfo.InvariantCulture);
- #else
+ #if BIT64
return ((long)m_value).ToString(CultureInfo.InvariantCulture);
+ #else // !BIT64 (32)
+ return ((int)m_value).ToString(CultureInfo.InvariantCulture);
#endif
}
{
Contract.Ensures(Contract.Result<String>() != null);
- #if WIN32
- return ((int)m_value).ToString(format, CultureInfo.InvariantCulture);
- #else
+ #if BIT64
return ((long)m_value).ToString(format, CultureInfo.InvariantCulture);
+ #else // !BIT64 (32)
+ return ((int)m_value).ToString(format, CultureInfo.InvariantCulture);
#endif
}
[System.Runtime.Versioning.NonVersionable]
public unsafe static explicit operator int (IntPtr value)
{
- #if WIN32
- return (int)value.m_value;
- #else
+ #if BIT64
long l = (long)value.m_value;
return checked((int)l);
+ #else // !BIT64 (32)
+ return (int)value.m_value;
#endif
}
[System.Runtime.Versioning.NonVersionable]
public unsafe static explicit operator long (IntPtr value)
{
- #if WIN32
- return (long)(int)value.m_value;
- #else
+ #if BIT64
return (long)value.m_value;
+ #else // !BIT64 (32)
+ return (long)(int)value.m_value;
#endif
}
[System.Runtime.Versioning.NonVersionable]
public static IntPtr operator +(IntPtr pointer, int offset)
{
- #if WIN32
- return new IntPtr(pointer.ToInt32() + offset);
- #else
+ #if BIT64
return new IntPtr(pointer.ToInt64() + offset);
+ #else // !BIT64 (32)
+ return new IntPtr(pointer.ToInt32() + offset);
#endif
}
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
[System.Runtime.Versioning.NonVersionable]
public static IntPtr operator -(IntPtr pointer, int offset) {
- #if WIN32
- return new IntPtr(pointer.ToInt32() - offset);
- #else
+ #if BIT64
return new IntPtr(pointer.ToInt64() - offset);
+ #else // !BIT64 (32)
+ return new IntPtr(pointer.ToInt32() - offset);
#endif
}
[System.Runtime.Versioning.NonVersionable]
get
{
- #if WIN32
- return 4;
- #else
+ #if BIT64
return 8;
+ #else // !BIT64 (32)
+ return 4;
#endif
}
}
// after the sync block, so don't count that.
// This property allows C#'s fixed statement to work on Strings.
// On 64 bit platforms, this should be 12 (8+4) and on 32 bit 8 (4+4).
-#if WIN32
- return 8;
-#else
+#if BIT64
return 12;
-#endif // WIN32
+#else // 32
+ return 8;
+#endif // BIT64
}
}
s_cookieTable.RemoveHandleIfPresent(handle);
#endif
-#if WIN32
- InternalFree((IntPtr)(((int)handle) & ~1));
-#else
+#if BIT64
InternalFree((IntPtr)(((long)handle) & ~1L));
+#else // BIT64 (32)
+ InternalFree((IntPtr)(((int)handle) & ~1));
#endif
}
else
internal IntPtr GetHandleValue()
{
-#if WIN32
- return new IntPtr(((int)m_handle) & ~1);
-#else
+#if BIT64
return new IntPtr(((long)m_handle) & ~1L);
+#else // !BIT64 (32)
+ return new IntPtr(((int)m_handle) & ~1);
#endif
}
internal bool IsPinned()
{
-#if WIN32
- return (((int)m_handle) & 1) != 0;
-#else
+#if BIT64
return (((long)m_handle) & 1) != 0;
+#else // !BIT64 (32)
+ return (((int)m_handle) & 1) != 0;
#endif
}
internal void SetIsPinned()
{
-#if WIN32
- m_handle = new IntPtr(((int)m_handle) | 1);
-#else
+#if BIT64
m_handle = new IntPtr(((long)m_handle) | 1L);
+#else // !BIT64 (32)
+ m_handle = new IntPtr(((int)m_handle) | 1);
#endif
}
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static IntPtr ReadIntPtr([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs)
{
- #if WIN32
- return (IntPtr) ReadInt32(ptr, ofs);
- #else
+ #if BIT64
return (IntPtr) ReadInt64(ptr, ofs);
+ #else // 32
+ return (IntPtr) ReadInt32(ptr, ofs);
#endif
}
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static IntPtr ReadIntPtr(IntPtr ptr, int ofs)
{
- #if WIN32
- return (IntPtr) ReadInt32(ptr, ofs);
- #else
+ #if BIT64
return (IntPtr) ReadInt64(ptr, ofs);
+ #else // 32
+ return (IntPtr) ReadInt32(ptr, ofs);
#endif
}
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static IntPtr ReadIntPtr(IntPtr ptr)
{
- #if WIN32
- return (IntPtr) ReadInt32(ptr, 0);
- #else
+ #if BIT64
return (IntPtr) ReadInt64(ptr, 0);
+ #else // 32
+ return (IntPtr) ReadInt32(ptr, 0);
#endif
}
[System.Security.SecurityCritical] // auto-generated_required
public static void WriteIntPtr(IntPtr ptr, int ofs, IntPtr val)
{
- #if WIN32
- WriteInt32(ptr, ofs, (int)val);
- #else
+ #if BIT64
WriteInt64(ptr, ofs, (long)val);
+ #else // 32
+ WriteInt32(ptr, ofs, (int)val);
#endif
}
[System.Security.SecurityCritical] // auto-generated_required
public static void WriteIntPtr([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, IntPtr val)
{
- #if WIN32
- WriteInt32(ptr, ofs, (int)val);
- #else
+ #if BIT64
WriteInt64(ptr, ofs, (long)val);
+ #else // 32
+ WriteInt32(ptr, ofs, (int)val);
#endif
}
[System.Security.SecurityCritical] // auto-generated_required
public static void WriteIntPtr(IntPtr ptr, IntPtr val)
{
- #if WIN32
- WriteInt32(ptr, 0, (int)val);
- #else
+ #if BIT64
WriteInt64(ptr, 0, (long)val);
+ #else // 32
+ WriteInt32(ptr, 0, (int)val);
#endif
}
// though I couldn't reproduce that. In either case, that means we should continue
// throwing an OOM instead of an ArgumentOutOfRangeException for "negative" amounts of memory.
UIntPtr numBytes;
-#if WIN32
- numBytes = new UIntPtr(unchecked((uint)cb.ToInt32()));
-#else
+#if BIT64
numBytes = new UIntPtr(unchecked((ulong)cb.ToInt64()));
+#else // 32
+ numBytes = new UIntPtr(unchecked((uint)cb.ToInt32()));
#endif
IntPtr pNewMem = Win32Native.LocalAlloc_NoSafeHandle(LMEM_FIXED, unchecked(numBytes));
namespace System.Runtime.InteropServices.WindowsRuntime
{
-#if WIN64
+#if BIT64
[StructLayout(LayoutKind.Explicit, Size = 24)]
#else
[StructLayout(LayoutKind.Explicit, Size = 20)]
}
-#if WIN64
+#if BIT64
private const int charPtrAlignConst = 3;
private const int alignConst = 7;
#else
char* a = ap;
char* b = bp;
-#if WIN64
+#if BIT64
// Single int read aligns pointers for the following long reads
// PERF: No length check needed as there is always an int32 worth of string allocated
// This read can also include the null terminator which both strings will have
char* a = ap;
char* b = bp;
-#if WIN64
+#if BIT64
// Single int read aligns pointers for the following long reads
// No length check needed as this method is called when length >= 2
Contract.Assert(length >= 2);
Contract.Assert(src[this.Length] == '\0', "src[this.Length] == '\\0'");
Contract.Assert( ((int)src)%4 == 0, "Managed string should start at 4 bytes boundary");
-#if WIN32
- int hash1 = (5381<<16) + 5381;
-#else
+#if BIT64
int hash1 = 5381;
+#else // !BIT64 (32)
+ int hash1 = (5381<<16) + 5381;
#endif
int hash2 = hash1;
-
-#if WIN32
+#if BIT64
+ int c;
+ char *s = src;
+ while ((c = s[0]) != 0) {
+ hash1 = ((hash1 << 5) + hash1) ^ c;
+ c = s[1];
+ if (c == 0)
+ break;
+ hash2 = ((hash2 << 5) + hash2) ^ c;
+ s += 2;
+ }
+#else // !BIT64 (32)
// 32 bit machines.
int* pint = (int *)src;
int len = this.Length;
{
hash1 = ((hash1 << 5) + hash1 + (hash1 >> 27)) ^ pint[0];
}
-#else
- int c;
- char *s = src;
- while ((c = s[0]) != 0) {
- hash1 = ((hash1 << 5) + hash1) ^ c;
- c = s[1];
- if (c == 0)
- break;
- hash2 = ((hash2 << 5) + hash2) ^ c;
- s += 2;
- }
#endif
#if DEBUG
// We want to ensure we can change our hash function daily.
fixed (char* src = &m_firstChar) {
Contract.Assert(src[this.Length] == '\0', "src[this.Length] == '\\0'");
Contract.Assert( ((int)src)%4 == 0, "Managed string should start at 4 bytes boundary");
-
-#if WIN32
- int hash1 = (5381<<16) + 5381;
-#else
+#if BIT64
int hash1 = 5381;
+#else // !BIT64 (32)
+ int hash1 = (5381<<16) + 5381;
#endif
int hash2 = hash1;
-#if WIN32
+#if BIT64
+ int c;
+ char *s = src;
+ while ((c = s[0]) != 0) {
+ hash1 = ((hash1 << 5) + hash1) ^ c;
+ c = s[1];
+ if (c == 0)
+ break;
+ hash2 = ((hash2 << 5) + hash2) ^ c;
+ s += 2;
+ }
+#else // !BIT64 (32)
// 32 bit machines.
int* pint = (int *)src;
int len = this.Length;
{
hash1 = ((hash1 << 5) + hash1 + (hash1 >> 27)) ^ pint[0];
}
-#else
- int c;
- char *s = src;
- while ((c = s[0]) != 0) {
- hash1 = ((hash1 << 5) + hash1) ^ c;
- c = s[1];
- if (c == 0)
- break;
- hash2 = ((hash2 << 5) + hash2) ^ c;
- s += 2;
- }
#endif
#if DEBUG
// We want to ensure we can change our hash function daily.
// but on ARM it will allow us to correctly determine the layout of native argument lists containing
// VARIANTs). Note that the field names here don't matter: none of the code refers to these fields,
// the structure just exists to provide size information to the IL marshaler.
-#if WIN64
+#if BIT64
IntPtr data1;
IntPtr data2;
#else
#endif
} // struct NativeVariant
-#if !WIN64 && !FEATURE_CORECLR
+#if !BIT64 && !FEATURE_CORECLR
// Structure filled by IL stubs if copy constructor(s) and destructor(s) need to be called
// on value types pushed on the stack. The structure is stored in s_copyCtorStubDesc by
// SetCopyCtorCookieChain and fetched by CopyCtorCallStubWorker. Must be stack-allocated.
public IntPtr m_pCookie;
public IntPtr m_pTarget;
} // struct CopyCtorStubDes
-#endif // !WIN64 && !FEATURE_CORECLR
+#endif // !BIT64 && !FEATURE_CORECLR
// Aggregates SafeHandle and the "owned" bit which indicates whether the SafeHandle
// has been successfully AddRef'ed. This allows us to do realiable cleanup (Release)
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static internal extern IntPtr GetDelegateTarget(Delegate pThis, ref IntPtr pStubArg);
-#if !WIN64 && !FEATURE_CORECLR
+#if !BIT64 && !FEATURE_CORECLR
// Written to by a managed stub helper, read by CopyCtorCallStubWorker in VM.
[ThreadStatic]
static CopyCtorStubDesc s_copyCtorStubDesc;
// Returns the final unmanaged stub target, ignores interceptors.
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static internal extern IntPtr GetFinalStubTarget(IntPtr pStubArg, IntPtr pUnmngThis, int dwStubFlags);
-#endif // !FEATURE_CORECLR && !WIN64
+#endif // !FEATURE_CORECLR && !BIT64
#if !FEATURE_CORECLR
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static internal extern IntPtr GetStubContext();
-#if WIN64
+#if BIT64
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static internal extern IntPtr GetStubContextAddr();
-#endif // WIN64
+#endif // BIT64
#if MDA_SUPPORTED
[MethodImplAttribute(MethodImplOptions.InternalCall)]
byteCount++;
}
-#if WIN64
+#if BIT64
// check for overflow
if (byteCount < 0) {
break;
break;
}
-#if WIN64
+#if BIT64
// make sure that we won't get a silent overflow inside the fast loop
// (Fall out to slow loop if we have this many characters)
availableChars &= 0x0FFFFFFF;
ch = 0;
}
-#if WIN64
+#if BIT64
// check for overflow
if (byteCount < 0) {
throw new ArgumentException(
if ( !bigEndian &&
#endif // BIGENDIAN
-#if WIN64 // 64 bit CPU needs to be long aligned for this to work.
+#if BIT64 // 64 bit CPU needs to be long aligned for this to work.
charLeftOver == 0 && (unchecked((long)chars) & 7) == 0)
#else
charLeftOver == 0 && (unchecked((int)chars) & 3) == 0)
#else
if ( !bigEndian &&
#endif // BIGENDIAN
-#if WIN64 // 64 bit CPU needs to be long aligned for this to work, 32 bit CPU needs to be 32 bit aligned
+#if BIT64 // 64 bit CPU needs to be long aligned for this to work, 32 bit CPU needs to be 32 bit aligned
(unchecked((long)chars) & 7) == 0 && (unchecked((long)bytes) & 7) == 0 &&
#else
(unchecked((int)chars) & 3) == 0 && (unchecked((int)bytes) & 3) == 0 &&
-#endif // WIN64
+#endif // BIT64
charLeftOver == 0)
{
// Need -1 to check 2 at a time. If we have an even #, longChars will go
!bigEndian &&
#endif // BIGENDIAN
-#if WIN64
+#if BIT64
(unchecked((long)chars) & 7) != (unchecked((long)bytes) & 7) && // Only do this if chars & bytes are out of line, otherwise faster loop'll be faster next time
#else
(unchecked((int)chars) & 3) != (unchecked((int)bytes) & 3) && // Only do this if chars & bytes are out of line, otherwise faster loop'll be faster next time
-#endif // WIN64
+#endif // BIT64
(unchecked((int)(bytes)) & 1) == 0 )
{
// # to use
#else // BIGENDIAN
if (!bigEndian &&
#endif // BIGENDIAN
-#if WIN64 // win64 has to be long aligned
+#if BIT64 // win64 has to be long aligned
(unchecked((long)bytes) & 7) == 0 &&
#else
(unchecked((int)bytes) & 3) == 0 &&
-#endif // WIN64
+#endif // BIT64
lastByte == -1 && lastChar == 0)
{
// Need new char* so we can check 4 at a time
#else // BIGENDIAN
if (!bigEndian &&
#endif // BIGENDIAN
-#if WIN64 // win64 has to be long aligned
+#if BIT64 // win64 has to be long aligned
(unchecked((long)chars) & 7) == 0 && (unchecked((long)bytes) & 7) == 0 &&
#else
(unchecked((int)chars) & 3) == 0 && (unchecked((int)bytes) & 3) == 0 &&
-#endif // WIN64
+#endif // BIT64
lastByte == -1 && lastChar == 0)
{
// Need -1 to check 2 at a time. If we have an even #, longChars will go
return value;
}
-#if WIN64
+#if BIT64
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[System.Runtime.Versioning.NonVersionable]
public static long Read(ref long location)
location = value;
}
-#if WIN64
+#if BIT64
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[System.Runtime.Versioning.NonVersionable]
public static void Write(ref long location, long value)
[System.Runtime.Versioning.NonVersionable]
public unsafe UIntPtr(ulong value)
{
-#if WIN32
- m_value = (void*)checked((uint)value);
-#else
+#if BIT64
m_value = (void *)value;
+#else // 32
+ m_value = (void*)checked((uint)value);
#endif
}
[System.Security.SecuritySafeCritical] // auto-generated
public unsafe override int GetHashCode() {
#if FEATURE_CORECLR
- #if WIN32
- return unchecked((int)m_value);
- #else
+ #if BIT64
ulong l = (ulong)m_value;
return (unchecked((int)l) ^ (int)(l >> 32));
+ #else // 32
+ return unchecked((int)m_value);
#endif
#else
return unchecked((int)((long)m_value)) & 0x7fffffff;
[System.Security.SecuritySafeCritical] // auto-generated
[System.Runtime.Versioning.NonVersionable]
public unsafe uint ToUInt32() {
-#if WIN32
- return (uint)m_value;
-#else
+#if BIT64
return checked((uint)m_value);
+#else // 32
+ return (uint)m_value;
#endif
}
public unsafe override String ToString() {
Contract.Ensures(Contract.Result<String>() != null);
-#if WIN32
- return ((uint)m_value).ToString(CultureInfo.InvariantCulture);
-#else
+#if BIT64
return ((ulong)m_value).ToString(CultureInfo.InvariantCulture);
+#else // 32
+ return ((uint)m_value).ToString(CultureInfo.InvariantCulture);
#endif
}
[System.Runtime.Versioning.NonVersionable]
public unsafe static explicit operator uint(UIntPtr value)
{
-#if WIN32
- return (uint)value.m_value;
-#else
+#if BIT64
return checked((uint)value.m_value);
+#else // 32
+ return (uint)value.m_value;
#endif
}
[System.Runtime.Versioning.NonVersionable]
public static UIntPtr operator +(UIntPtr pointer, int offset) {
- #if WIN32
- return new UIntPtr(pointer.ToUInt32() + (uint)offset);
- #else
+ #if BIT64
return new UIntPtr(pointer.ToUInt64() + (ulong)offset);
+ #else // 32
+ return new UIntPtr(pointer.ToUInt32() + (uint)offset);
#endif
}
[System.Runtime.Versioning.NonVersionable]
public static UIntPtr operator -(UIntPtr pointer, int offset) {
- #if WIN32
- return new UIntPtr(pointer.ToUInt32() - (uint)offset);
- #else
+ #if BIT64
return new UIntPtr(pointer.ToUInt64() - (ulong)offset);
+ #else // 32
+ return new UIntPtr(pointer.ToUInt32() - (uint)offset);
#endif
}
[System.Runtime.Versioning.NonVersionable]
get
{
-#if WIN32
- return 4;
-#else
+#if BIT64
return 8;
+#else // 32
+ return 4;
#endif
}
}