Files
Linux/Documentation
Dave Thaler 0e133a1337 bpf, docs: Define signed modulo as using truncated division
There's different mathematical definitions (truncated, floored, rounded,
etc.) and different languages have chosen different definitions [0][1].
E.g., languages/libraries that follow Knuth use a different mathematical
definition than C uses. This patch specifies which definition BPF uses,
as verified by Eduard [2] and others.

  [0] https://en.wikipedia.org/wiki/Modulo#Variants_of_the_definition
  [1] https://torstencurdt.com/tech/posts/modulo-of-negative-numbers/
  [2] https://lore.kernel.org/bpf/[email protected]/

Signed-off-by: Dave Thaler <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: David Vernet <[email protected]>
Acked-by: Eduard Zingerman <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
2023-10-19 01:36:12 +02:00
..
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…