]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Merge intoverflow.h into qdefs.h
authorCloudwalk <cloudwalk009@gmail.com>
Tue, 25 May 2021 20:13:24 +0000 (16:13 -0400)
committerCloudwalk <cloudwalk009@gmail.com>
Tue, 25 May 2021 20:13:24 +0000 (16:13 -0400)
darkplaces-sdl2-vs2017.vcxproj
darkplaces-sdl2-vs2019.vcxproj
gl_textures.c
intoverflow.h [deleted file]
qdefs.h

index eb3ac72a1aa960fcddbe05cc4fe48c011b76f4c4..b984b24bcec5e9623af2303c250f41e9b0fb7d13 100644 (file)
     <ClInclude Include="image.h" />\r
     <ClInclude Include="image_png.h" />\r
     <ClInclude Include="input.h" />\r
-    <ClInclude Include="intoverflow.h" />\r
     <ClInclude Include="jpeg.h" />\r
     <ClInclude Include="keys.h" />\r
     <ClInclude Include="lhfont.h" />\r
index c24c3c28fbd8ec64c05782a16072475b14a96fda..70055977964b6cfe80e1bbd5ec45f04d3163ea26 100644 (file)
     <ClInclude Include="image.h" />\r
     <ClInclude Include="image_png.h" />\r
     <ClInclude Include="input.h" />\r
-    <ClInclude Include="intoverflow.h" />\r
     <ClInclude Include="jpeg.h" />\r
     <ClInclude Include="keys.h" />\r
     <ClInclude Include="lhfont.h" />\r
index ee3d575b7ebc69a3232a5cbc1b2e256669cad28f..d1ec62a339fd981432898c4d441b3d4fc7172c87 100644 (file)
@@ -3,7 +3,6 @@
 #include "image.h"
 #include "jpeg.h"
 #include "image_png.h"
-#include "intoverflow.h"
 
 cvar_t gl_max_size = {CF_CLIENT | CF_ARCHIVE, "gl_max_size", "2048", "maximum allowed texture size, can be used to reduce video memory usage, limited by hardware capabilities (typically 2048, 4096, or 8192)"};
 cvar_t gl_max_lightmapsize = {CF_CLIENT | CF_ARCHIVE, "gl_max_lightmapsize", "512", "maximum allowed texture size for lightmap textures, use larger values to improve rendering speed, as long as there is enough video memory available (setting it too high for the hardware will cause very bad performance)"};
diff --git a/intoverflow.h b/intoverflow.h
deleted file mode 100644 (file)
index df90616..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef INTOVERFLOW_H
-#define INTOVERFLOW_H
-
-// simple safe library to handle integer overflows when doing buffer size calculations
-// Usage:
-//   - calculate data size using INTOVERFLOW_??? macros
-//   - compare: calculated-size <= INTOVERFLOW_NORMALIZE(buffersize)
-// Functionality:
-//   - all overflows (values > INTOVERFLOW_MAX) and errors are mapped to INTOVERFLOW_MAX
-//   - if any input of an operation is INTOVERFLOW_MAX, INTOVERFLOW_MAX will be returned
-//   - otherwise, regular arithmetics apply
-
-#define INTOVERFLOW_MAX 2147483647
-
-#define INTOVERFLOW_ADD(a,b) (((a) < INTOVERFLOW_MAX && (b) < INTOVERFLOW_MAX && (a) < INTOVERFLOW_MAX - (b)) ? ((a) + (b)) : INTOVERFLOW_MAX)
-#define INTOVERFLOW_SUB(a,b) (((a) < INTOVERFLOW_MAX && (b) < INTOVERFLOW_MAX && (b) <= (a))                  ? ((a) - (b)) : INTOVERFLOW_MAX)
-#define INTOVERFLOW_MUL(a,b) (((a) < INTOVERFLOW_MAX && (b) < INTOVERFLOW_MAX && (a) < INTOVERFLOW_MAX / (b)) ? ((a) * (b)) : INTOVERFLOW_MAX)
-#define INTOVERFLOW_DIV(a,b) (((a) < INTOVERFLOW_MAX && (b) < INTOVERFLOW_MAX && (b) > 0)                     ? ((a) / (b)) : INTOVERFLOW_MAX)
-
-#define INTOVERFLOW_NORMALIZE(a) (((a) < INTOVERFLOW_MAX) ? (a) : (INTOVERFLOW_MAX - 1))
-
-#endif
diff --git a/qdefs.h b/qdefs.h
index 463761e9b43a311993b6b182edf5f657c07b9a72..5d0655f77f6e0b519bab330b08678166e20e639f 100644 (file)
--- a/qdefs.h
+++ b/qdefs.h
 #define INT_LOSSLESS_FORMAT_CONVERT_U(x) ((uintmax_t)(x))
 #endif
 
+// simple safe library to handle integer overflows when doing buffer size calculations
+// Usage:
+//   - calculate data size using INTOVERFLOW_??? macros
+//   - compare: calculated-size <= INTOVERFLOW_NORMALIZE(buffersize)
+// Functionality:
+//   - all overflows (values > INTOVERFLOW_MAX) and errors are mapped to INTOVERFLOW_MAX
+//   - if any input of an operation is INTOVERFLOW_MAX, INTOVERFLOW_MAX will be returned
+//   - otherwise, regular arithmetics apply
+
+#define INTOVERFLOW_MAX 2147483647
+
+#define INTOVERFLOW_ADD(a,b) (((a) < INTOVERFLOW_MAX && (b) < INTOVERFLOW_MAX && (a) < INTOVERFLOW_MAX - (b)) ? ((a) + (b)) : INTOVERFLOW_MAX)
+#define INTOVERFLOW_SUB(a,b) (((a) < INTOVERFLOW_MAX && (b) < INTOVERFLOW_MAX && (b) <= (a))                  ? ((a) - (b)) : INTOVERFLOW_MAX)
+#define INTOVERFLOW_MUL(a,b) (((a) < INTOVERFLOW_MAX && (b) < INTOVERFLOW_MAX && (a) < INTOVERFLOW_MAX / (b)) ? ((a) * (b)) : INTOVERFLOW_MAX)
+#define INTOVERFLOW_DIV(a,b) (((a) < INTOVERFLOW_MAX && (b) < INTOVERFLOW_MAX && (b) > 0)                     ? ((a) / (b)) : INTOVERFLOW_MAX)
+
+#define INTOVERFLOW_NORMALIZE(a) (((a) < INTOVERFLOW_MAX) ? (a) : (INTOVERFLOW_MAX - 1))
+
 #endif