mirror of https://github.com/ppy/SDL3-CS.git
Fix errors in `SDL_stdinc.g.cs` with define magic
This commit is contained in:
parent
efc9422f7c
commit
4fbe435cbe
|
|
@ -517,11 +517,6 @@ namespace SDL
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int SDL_size_mul_overflow_builtin([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret)
|
|
||||||
{
|
|
||||||
return (__builtin_mul_overflow(a, b, ret)) ? 1 : 0 == 0 ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int SDL_size_add_overflow([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret)
|
public static int SDL_size_add_overflow([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret)
|
||||||
{
|
{
|
||||||
if (b > 0xffffffffffffffffUL - a)
|
if (b > 0xffffffffffffffffUL - a)
|
||||||
|
|
@ -533,19 +528,6 @@ namespace SDL
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int SDL_size_add_overflow_builtin([NativeTypeName("size_t")] nuint a, [NativeTypeName("size_t")] nuint b, [NativeTypeName("size_t *")] nuint* ret)
|
|
||||||
{
|
|
||||||
return (__builtin_add_overflow(a, b, ret)) ? 1 : 0 == 0 ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
||||||
[return: NativeTypeName("bool")]
|
|
||||||
public static extern byte __builtin_mul_overflow(__arglist);
|
|
||||||
|
|
||||||
[DllImport("SDL3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
|
|
||||||
[return: NativeTypeName("bool")]
|
|
||||||
public static extern byte __builtin_add_overflow(__arglist);
|
|
||||||
|
|
||||||
[NativeTypeName("#define SDL_SIZE_MAX SIZE_MAX")]
|
[NativeTypeName("#define SDL_SIZE_MAX SIZE_MAX")]
|
||||||
public const ulong SDL_SIZE_MAX = 0xffffffffffffffffUL;
|
public const ulong SDL_SIZE_MAX = 0xffffffffffffffffUL;
|
||||||
|
|
||||||
|
|
@ -636,15 +618,6 @@ namespace SDL
|
||||||
[NativeTypeName("#define SDL_PRIX32 \"X\"")]
|
[NativeTypeName("#define SDL_PRIX32 \"X\"")]
|
||||||
public static ReadOnlySpan<byte> SDL_PRIX32 => "X"u8;
|
public static ReadOnlySpan<byte> SDL_PRIX32 => "X"u8;
|
||||||
|
|
||||||
[NativeTypeName("#define SDL_memcpy memcpy")]
|
|
||||||
public static readonly delegate*<void*, void*, nuint, void*> SDL_memcpy = &memcpy;
|
|
||||||
|
|
||||||
[NativeTypeName("#define SDL_memmove memmove")]
|
|
||||||
public static readonly delegate*<void*, void*, nuint, void*> SDL_memmove = &memmove;
|
|
||||||
|
|
||||||
[NativeTypeName("#define SDL_memset memset")]
|
|
||||||
public static readonly delegate*<void*, int, nuint, void*> SDL_memset = &memset;
|
|
||||||
|
|
||||||
[NativeTypeName("#define SDL_PI_D 3.141592653589793238462643383279502884")]
|
[NativeTypeName("#define SDL_PI_D 3.141592653589793238462643383279502884")]
|
||||||
public const double SDL_PI_D = 3.141592653589793238462643383279502884;
|
public const double SDL_PI_D = 3.141592653589793238462643383279502884;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
# Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
# See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
# Prevent SDL memory functions from being defined to compiler intrinsic ones
|
||||||
|
--define-macro
|
||||||
|
SDL_SLOW_MEMCPY
|
||||||
|
SDL_SLOW_MEMMOVE
|
||||||
|
SDL_SLOW_MEMSET
|
||||||
|
|
||||||
|
# Prevent SDL from using compiler intrinsics __builtin_mul_overflow and __builtin_add_overflow.
|
||||||
|
--additional
|
||||||
|
--undefine-macro=__has_builtin
|
||||||
Loading…
Reference in New Issue