diff options
author | bptato <nincsnevem662@gmail.com> | 2023-06-10 01:56:08 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-06-10 01:56:08 +0200 |
commit | 1bd7651f70ef7ba7a3506f12d4c9f4d7735180f5 (patch) | |
tree | f05b9750153e18e2d3856869e7df4a2ea69f58ea /src/utils | |
parent | e8e9d27c9496ee5a0679197272d5ca8d1b5a2953 (diff) | |
download | chawan-1bd7651f70ef7ba7a3506f12d4c9f4d7735180f5.tar.gz |
approximateANSIColor: fix possible underflow
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/chamath.nim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils/chamath.nim b/src/utils/chamath.nim new file mode 100644 index 00000000..579b7b69 --- /dev/null +++ b/src/utils/chamath.nim @@ -0,0 +1,4 @@ +func absSub*(a, b: SomeUnsignedInt): auto {.inline.} = + if a > b: + return a - b + return b - a |