Replaced fabs() by fabsf() when required

This commit is contained in:
Ray 2020-02-28 12:54:39 +01:00
parent 572969d8b7
commit 1ee6290fcf
4 changed files with 17 additions and 17 deletions

View File

@ -45,10 +45,10 @@
#include "utils.h" // Required for: fopen() Android mapping
#include <stdlib.h> // Required for: malloc(), free(), fabs()
#include <stdlib.h> // Required for: malloc(), free()
#include <stdio.h> // Required for: FILE, fopen(), fclose()
#include <string.h> // Required for: strncmp() [Used in LoadModelAnimations()], strlen() [Used in LoadTextureFromCgltfImage()]
#include <math.h> // Required for: sinf(), cosf(), sqrtf()
#include <math.h> // Required for: sinf(), cosf(), sqrtf(), fabsf()
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
@ -2513,9 +2513,9 @@ void DrawBoundingBox(BoundingBox box, Color color)
{
Vector3 size;
size.x = (float)fabs(box.max.x - box.min.x);
size.y = (float)fabs(box.max.y - box.min.y);
size.z = (float)fabs(box.max.z - box.min.z);
size.x = fabsf(box.max.x - box.min.x);
size.y = fabsf(box.max.y - box.min.y);
size.z = fabsf(box.max.z - box.min.z);
Vector3 center = { box.min.x + size.x/2.0f, box.min.y + size.y/2.0f, box.min.z + size.z/2.0f };
@ -2761,7 +2761,7 @@ RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight)
RayHitInfo result = { 0 };
if (fabs(ray.direction.y) > EPSILON)
if (fabsf(ray.direction.y) > EPSILON)
{
float distance = (ray.position.y - groundHeight)/-ray.direction.y;

View File

@ -612,10 +612,10 @@ RLAPI int GetPixelDataSize(int width, int height, int format);// Get pixel data
#endif
#endif
#include <stdlib.h> // Required for: malloc(), free(), fabs()
#include <stdlib.h> // Required for: malloc(), free()
#include <stdio.h> // Required for: fopen(), fseek(), fread(), fclose() [LoadText]
#include <string.h> // Required for: strcmp(), strlen() [Used in rlglInit(), on extensions loading]
#include <math.h> // Required for: atan2f()
#include <math.h> // Required for: atan2f(), fabs()
#if !defined(RLGL_STANDALONE)
#include "raymath.h" // Required for: Vector3 and Matrix functions
@ -3662,7 +3662,7 @@ void SetVrConfiguration(VrDeviceInfo hmd, Shader distortion)
// Compute distortion scale parameters
// NOTE: To get lens max radius, lensShift must be normalized to [-1..1]
float lensRadius = (float)fabs(-1.0f - 4.0f*lensShift);
float lensRadius = fabsf(-1.0f - 4.0f*lensShift);
float lensRadiusSq = lensRadius*lensRadius;
float distortionScale = hmd.lensDistortionValues[0] +
hmd.lensDistortionValues[1]*lensRadiusSq +

View File

@ -42,8 +42,7 @@
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
#include <stdlib.h> // Required for: fabs()
#include <math.h> // Required for: sinf(), asinf(), cosf(), acosf(), sqrtf()
#include <math.h> // Required for: sinf(), asinf(), cosf(), acosf(), sqrtf(), fabsf()
//----------------------------------------------------------------------------------
// Defines and Macros
@ -1471,8 +1470,8 @@ bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
int recCenterX = (int)(rec.x + rec.width/2.0f);
int recCenterY = (int)(rec.y + rec.height/2.0f);
float dx = (float)fabs(center.x - recCenterX);
float dy = (float)fabs(center.y - recCenterY);
float dx = fabsf(center.x - (float)recCenterX);
float dy = fabsf(center.y - (float)recCenterY);
if (dx > (rec.width/2.0f + radius)) { return false; }
if (dy > (rec.height/2.0f + radius)) { return false; }
@ -1493,8 +1492,8 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
if (CheckCollisionRecs(rec1, rec2))
{
float dxx = (float)fabs(rec1.x - rec2.x);
float dyy = (float)fabs(rec1.y - rec2.y);
float dxx = fabsf(rec1.x - rec2.x);
float dyy = fabsf(rec1.y - rec2.y);
if (rec1.x <= rec2.x)
{

View File

@ -64,9 +64,10 @@
#include "config.h" // Defines module configuration flags
#endif
#include <stdlib.h> // Required for: malloc(), free(), fabs()
#include <stdlib.h> // Required for: malloc(), free()
#include <stdio.h> // Required for: FILE, fopen(), fclose(), fread()
#include <string.h> // Required for: strlen() [Used in ImageTextEx()]
#include <math.h> // Required for: fabsf()
#include "utils.h" // Required for: fopen() Android mapping
@ -2688,7 +2689,7 @@ void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float sc
// Draw a part of a texture (defined by a rectangle)
void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint)
{
Rectangle destRec = { position.x, position.y, (float)fabs(sourceRec.width), (float)fabs(sourceRec.height) };
Rectangle destRec = { position.x, position.y, fabsf(sourceRec.width), fabsf(sourceRec.height) };
Vector2 origin = { 0.0f, 0.0f };
DrawTexturePro(texture, sourceRec, destRec, origin, 0.0f, tint);