threads / patch / 49694

patch, 3 partsewok_rlw.h: add missing 'inline' to function definition

Subject: [PATCH 2/3] ewok_rlw.h: add missing 'inline' to function definition

## tl;dr

2 messages between Oct 27, 2018 and Oct 27, 2018. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Ramsay Jones· Oct 27, 2018, 01:52 UTC · lore

The 'ewok_rlw.h' header file contains the rlw_get_run_bit() function definition, which is marked as 'static' but not 'inline'. At least when compiled by gcc, with the default -O2 optimization level, the function is actually inlined and leaves no static version in the ewah_bitmap.o and ewah_rlw.o object files. Despite this, add the missing 'inline' keyword to better describe the intended behaviour.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
 ewah/ewok_rlw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to ewah/ewok_rlw.h +1 −1
diff --git a/ewah/ewok_rlw.h b/ewah/ewok_rlw.h
index d487966935..bafa24f4c3 100644
--- a/ewah/ewok_rlw.h
+++ b/ewah/ewok_rlw.h
@@ -31,7 +31,7 @@
 
 #define RLW_RUNNING_LEN_PLUS_BIT (((eword_t)1 << (RLW_RUNNING_BITS + 1)) - 1)
 
-static int rlw_get_run_bit(const eword_t *word)
+static inline int rlw_get_run_bit(const eword_t *word)
 {
 	return *word & (eword_t)1;
 }
-- 
2.19.0
Jeff King· Oct 27, 2018, 06:29 UTC · re: Ramsay Jones · lore

Re: [PATCH 2/3] ewok_rlw.h: add missing 'inline' to function definition

On Sat, Oct 27, 2018 at 02:52:05AM +0100, Ramsay Jones wrote:
Show 6 quoted lines
> The 'ewok_rlw.h' header file contains the rlw_get_run_bit() function
> definition, which is marked as 'static' but not 'inline'. At least when
> compiled by gcc, with the default -O2 optimization level, the function
> is actually inlined and leaves no static version in the ewah_bitmap.o
> and ewah_rlw.o object files. Despite this, add the missing 'inline'
> keyword to better describe the intended behaviour.
Yep, this makes sense. Thanks!
-Peff

← back to recent threads