modetest: fix build error on is_power_of_two()

The inline function is_power_of_two should be set as static since it's
only called in pattern.c, otherwise it will encounter below build error.

[114/136] Linking target tests/modetest/modetest
FAILED: tests/modetest/modetest
cc  -o tests/modetest/modetest tests/modetest/modetest.p/buffers.c.o tests/modetest/modetest.p/cursor.c.o tests/modetest/modetest.p/modetest.c.o -Wl,--as-needed -Wl,--no-undefined -fno-omit-frame-pointer '-Wl,-rpath,$ORIGIN/../..' -Wl,-rpath-link,/home/ray/repo/drm/build/ -Wl,--start-group libdrm.so.2.125.0 tests/util/libutil.a -lm -pthread /usr/lib/x86_64-linux-gnu/libcairo.so -Wl,--end-group
/usr/bin/ld: tests/util/libutil.a.p/pattern.c.o: in function `check_yuv':
/home/ray/repo/drm/build/../tests/util/pattern.c:1989: undefined reference to `is_power_of_two'
/usr/bin/ld: /home/ray/repo/drm/build/../tests/util/pattern.c:1990: undefined reference to `is_power_of_two'
/usr/bin/ld: /home/ray/repo/drm/build/../tests/util/pattern.c:1991: undefined reference to `is_power_of_two'
collect2: error: ld returned 1 exit status

Signed-off-by: Huang Rui <ray.huang@amd.com>
This commit is contained in:
Huang Rui 2025-07-14 14:45:14 +08:00
parent e4bd1ba753
commit 9ea8a8e93d

View file

@ -1978,7 +1978,7 @@ static void insert_value_yuv_planar(const struct util_format_info *info,
v_mem[x/xsub*cs] = val.v; v_mem[x/xsub*cs] = val.v;
} }
inline bool is_power_of_two(unsigned long val) static inline bool is_power_of_two(unsigned long val)
{ {
return (val != 0) && ((val & (val - 1)) == 0); return (val != 0) && ((val & (val - 1)) == 0);
} }