]> git.ipfire.org Git - thirdparty/systemd.git/commit
fundamental: add ABS_DIFF macro
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Sat, 11 Apr 2026 11:06:56 +0000 (13:06 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Sat, 11 Apr 2026 12:58:34 +0000 (14:58 +0200)
commitefbd8a26d65c68a16c64e3d8cb5ae9d298ac6abb
tree560ff91e34e2a7181c663850c722ec397e476371
parentc9defc1bebe203ab0ccf7a4a58b56360a2e0cc21
fundamental: add ABS_DIFF macro

Sometimes we want need to diff two unsigned numbers, which is awkward
because we need to cast them to something with a sign first, if we want
to use abs(). Let's add a helper that avoids the function call
altogether.

Also drop unnecessary parens arounds args which are delimited by commas.
src/fundamental/macro-fundamental.h
src/test/test-macro.c