aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-06-16 09:01:14 +0200
committerGravatar Christian Hesse <mail@eworm.de>2021-06-16 10:16:35 +0200
commitc60c96e32a8ab017c93d450d710a650c41fc76a7 (patch)
tree8cf3f20b5ef9e3804c0006805b81e2852d54dc63 /global-functions
parent1ce0f63ef7206e130981a2ab49f3fbda281b0a12 (diff)
global-functions: $HexToNum: properly handle capital characters
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions4
1 files changed, 2 insertions, 2 deletions
diff --git a/global-functions b/global-functions
index d4aa574..2cfe595 100644
--- a/global-functions
+++ b/global-functions
@@ -429,12 +429,12 @@
# convert from hex (string) to num
:set HexToNum do={
:local Input [ :tostr $1 ];
- :local Hex "0123456789abcdef";
+ :local Hex "0123456789abcdef0123456789ABCDEF";
:local Multi 1;
:local Return 0;
:for I from=([ :len $Input ] - 1) to=0 do={
- :set Return ($Return + ([ :find $Hex [ :pick $Input $I ] ] * $Multi));
+ :set Return ($Return + (([ :find $Hex [ :pick $Input $I ] ] % 16) * $Multi));
:set Multi ($Multi * 16);
}