]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use correct MOD macro.
authorAlan T. DeKok <aland@freeradius.org>
Thu, 2 Sep 2021 15:00:28 +0000 (11:00 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 2 Sep 2021 15:00:28 +0000 (11:00 -0400)
src/lib/util/value.c

index 2f3db9520631ad1a555e704b1f304aa324a41a4c..31703de9cfac67c85a10101967a496826363adce 100644 (file)
@@ -5003,7 +5003,7 @@ ssize_t fr_value_box_print(fr_sbuff_t *out, fr_value_box_t const *data, fr_sbuff
  *     The % operator can return a _signed_ value.  This macro is
  *     correct for both positive and negative inputs.
  */
-#define MOD(a,b) ((((a)%(b))+(b))%(b))
+#define MOD(a,b) (((a<0) ? (-a) : (a))%(b))
 
                switch (res) {
                default: