shithub: orca

Download patch

ref: b7c4dac86bf687c8f85b7089f56c13fa4fcc23c6
parent: e24d9fc715e658089ebeb81519e7dbc5218770d3
author: cancel <cancel@cancel.fm>
date: Sat Dec 1 11:05:57 EST 2018

Add ORCA_OK_IF_UNUSED, remove force inline on mark.h fns

--- a/base.h
+++ b/base.h
@@ -41,11 +41,13 @@
 #define ORCA_PURE __attribute__((pure))
 #define ORCA_LIKELY(_x) __builtin_expect(_x, 1)
 #define ORCA_UNLIKELY(_x) __builtin_expect(_x, 0)
+#define ORCA_OK_IF_UNUSED __attribute__((unused))
 #else
 #define ORCA_ASSUME_ALIGNED(_ptr, _alignment) (_ptr)
 #define ORCA_PURE
 #define ORCA_LIKELY(_x) (_x)
 #define ORCA_UNLIKELY(_x) (_x)
+#define ORCA_OK_IF_UNUSED
 #endif
 
 // array count, safer on gcc/clang
--- a/mark.h
+++ b/mark.h
@@ -23,21 +23,21 @@
 
 void mbuffer_clear(Mbuffer map, Usz height, Usz width);
 
-ORCA_FORCE_INLINE
-Mark_flags mbuffer_peek_relative(Mbuffer map, Usz map_height,
-                                 Usz map_width, Usz y, Usz x, Isz offs_y,
-                                 Isz offs_x);
-ORCA_FORCE_INLINE
-void mbuffer_poke_relative(Mbuffer map, Usz map_height, Usz map_width,
-                           Usz y, Usz x, Isz offs_y, Isz offs_x,
-                           Mark_flags flags);
+ORCA_OK_IF_UNUSED
+static Mark_flags mbuffer_peek_relative(Mbuffer map, Usz map_height,
+                                        Usz map_width, Usz y, Usz x, Isz offs_y,
+                                        Isz offs_x);
+ORCA_OK_IF_UNUSED
+static void mbuffer_poke_relative(Mbuffer map, Usz map_height, Usz map_width,
+                                  Usz y, Usz x, Isz offs_y, Isz offs_x,
+                                  Mark_flags flags);
 
 // Inline implementation
 
-ORCA_FORCE_INLINE
-Mark_flags mbuffer_peek_relative(Mbuffer map, Usz map_height,
-                                 Usz map_width, Usz y, Usz x, Isz offs_y,
-                                 Isz offs_x) {
+ORCA_OK_IF_UNUSED
+static Mark_flags mbuffer_peek_relative(Mbuffer map, Usz map_height,
+                                        Usz map_width, Usz y, Usz x, Isz offs_y,
+                                        Isz offs_x) {
   Isz y0 = (Isz)y + offs_y;
   Isz x0 = (Isz)x + offs_x;
   if (y0 >= (Isz)map_height || x0 >= (Isz)map_width || y0 < 0 || x0 < 0)
@@ -45,10 +45,10 @@
   return map[(Usz)y0 * map_width + (Usz)x0];
 }
 
-ORCA_FORCE_INLINE
-void mbuffer_poke_relative(Mbuffer map, Usz map_height, Usz map_width,
-                           Usz y, Usz x, Isz offs_y, Isz offs_x,
-                           Mark_flags flags) {
+ORCA_OK_IF_UNUSED
+static void mbuffer_poke_relative(Mbuffer map, Usz map_height, Usz map_width,
+                                  Usz y, Usz x, Isz offs_y, Isz offs_x,
+                                  Mark_flags flags) {
   Isz y0 = (Isz)y + offs_y;
   Isz x0 = (Isz)x + offs_x;
   if (y0 >= (Isz)map_height || x0 >= (Isz)map_width || y0 < 0 || x0 < 0)
@@ -56,10 +56,11 @@
   map[(Usz)y0 * map_width + (Usz)x0] = (U8)flags;
 }
 
-ORCA_FORCE_INLINE
-void mbuffer_poke_relative_flags_or(Mbuffer map, Usz map_height,
-                                    Usz map_width, Usz y, Usz x, Isz offs_y,
-                                    Isz offs_x, Mark_flags flags) {
+ORCA_OK_IF_UNUSED
+static void mbuffer_poke_relative_flags_or(Mbuffer map, Usz map_height,
+                                           Usz map_width, Usz y, Usz x,
+                                           Isz offs_y, Isz offs_x,
+                                           Mark_flags flags) {
   Isz y0 = (Isz)y + offs_y;
   Isz x0 = (Isz)x + offs_x;
   if (y0 >= (Isz)map_height || x0 >= (Isz)map_width || y0 < 0 || x0 < 0)
@@ -67,16 +68,16 @@
   map[(Usz)y0 * map_width + (Usz)x0] |= (U8)flags;
 }
 
-ORCA_FORCE_INLINE
-void mbuffer_poke_flags_or(Mbuffer map, Usz map_height, Usz map_width,
-                           Usz y, Usz x, Mark_flags flags) {
+ORCA_OK_IF_UNUSED
+static void mbuffer_poke_flags_or(Mbuffer map, Usz map_height, Usz map_width,
+                                  Usz y, Usz x, Mark_flags flags) {
   (void)map_height;
   map[y * map_width + x] |= (U8)flags;
 }
 
-ORCA_FORCE_INLINE
-Mark_flags mbuffer_peek(Mbuffer map, Usz map_height, Usz map_width,
-                        Usz y, Usz x) {
+ORCA_OK_IF_UNUSED
+static Mark_flags mbuffer_peek(Mbuffer map, Usz map_height, Usz map_width,
+                               Usz y, Usz x) {
   (void)map_height;
   return map[y * map_width + x];
 }