File tree 3 files changed +21
-7
lines changed
3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 1
- cmake_minimum_required (VERSION 3.12)
1
+ cmake_minimum_required (VERSION 3.25)
2
+ #this change avoid the warning that appear when we include raylib using Cmake fatch content
2
3
project (raylib)
3
4
4
5
# Avoid excessive expansion of variables in conditionals. In particular, if
Original file line number Diff line number Diff line change @@ -742,7 +742,7 @@ rcore.o : rcore.c raylib.h rlgl.h utils.h raymath.h rcamera.h rgestures.h
742
742
743
743
# Compile rglfw module
744
744
rglfw.o : rglfw.c
745
- $(CC ) $(GLFW_OSX ) -c $< $(CFLAGS ) $(INCLUDE_PATHS )
745
+ $(CC ) $(GLFW_OSX ) -c $< $(CFLAGS ) $(INCLUDE_PATHS ) -U_GNU_SOURCE
746
746
747
747
# Compile shapes module
748
748
rshapes.o : rshapes.c raylib.h rlgl.h
Original file line number Diff line number Diff line change @@ -5390,13 +5390,19 @@ static float HalfToFloat(unsigned short x)
5390
5390
{
5391
5391
float result = 0.0f ;
5392
5392
5393
+ union
5394
+ {
5395
+ float fm ;
5396
+ unsigned int ui ;
5397
+ } uni ;
5398
+
5393
5399
const unsigned int e = (x & 0x7C00 ) >> 10 ; // Exponent
5394
5400
const unsigned int m = (x & 0x03FF ) << 13 ; // Mantissa
5395
- const float fm = (float )m ;
5396
- const unsigned int v = ( * ( unsigned int * ) & fm ) >> 23 ; // Evil log2 bit hack to count leading zeros in denormalized format
5397
- const unsigned int r = (x & 0x8000 ) << 16 | (e != 0 )* ((e + 112 ) << 23 | m ) | ((e == 0 )& (m != 0 ))* ((v - 37 ) << 23 | ((m << (150 - v )) & 0x007FE000 )); // sign : normalized : denormalized
5401
+ uni . fm = (float )m ;
5402
+ const unsigned int v = uni . ui >> 23 ; // Evil log2 bit hack to count leading zeros in denormalized format
5403
+ uni . ui = (x & 0x8000 ) << 16 | (e != 0 )* ((e + 112 ) << 23 | m ) | ((e == 0 )& (m != 0 ))* ((v - 37 ) << 23 | ((m << (150 - v )) & 0x007FE000 )); // sign : normalized : denormalized
5398
5404
5399
- result = * ( float * ) & r ;
5405
+ result = uni . fm ;
5400
5406
5401
5407
return result ;
5402
5408
}
@@ -5406,7 +5412,14 @@ static unsigned short FloatToHalf(float x)
5406
5412
{
5407
5413
unsigned short result = 0 ;
5408
5414
5409
- const unsigned int b = (* (unsigned int * ) & x ) + 0x00001000 ; // Round-to-nearest-even: add last bit after truncated mantissa
5415
+ union
5416
+ {
5417
+ float fm ;
5418
+ unsigned int ui ;
5419
+ } uni ;
5420
+ uni .fm = x ;
5421
+
5422
+ const unsigned int b = uni .ui + 0x00001000 ; // Round-to-nearest-even: add last bit after truncated mantissa
5410
5423
const unsigned int e = (b & 0x7F800000 ) >> 23 ; // Exponent
5411
5424
const unsigned int m = b & 0x007FFFFF ; // Mantissa; in line below: 0x007FF000 = 0x00800000-0x00001000 = decimal indicator flag - initial rounding
5412
5425
You can’t perform that action at this time.
0 commit comments