From 4d8cb4ccdfd4cf561ed560edc7e59d6383f205c3 Mon Sep 17 00:00:00 2001 From: Sylvio Sell Date: Wed, 10 Feb 2021 14:55:47 +0100 Subject: [PATCH] little fix of bitsize-macro IntUtil for haxe 4.2 --- README.md | 8 +++++--- haxelib.json | 4 ++-- src/IntUtil.hx | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 863bb43..3720bbd 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ pure haxe implementation for [arbitrary-precision integer](https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic) This lib was designed and optimized for fast [Karatsuba](https://en.wikipedia.org/wiki/Karatsuba_algorithm) multiplicaton. -Works with haxe-version 3.4.4 and up. Tested on hashlink, cpp, neko and javascript targets. +Works with haxe-version 3.4.4 and up to 4.2. Tested on hashlink, cpp, neko and javascript targets. ## Installation @@ -26,9 +26,11 @@ haxelib install hxp haxelib run hxp --install-hxp-alias ``` -then simple call `hxp test hl neko ...` or +then simple call `hxp test hl neko ...`, `hxp bench ...` or `hxp help` into projectfolder to see more targetspecific options. +To add a new benchmark you only need to put a new .hx file into [benchmarks-folder](https://github.com/maitag/littleBigInt/tree/master/benchmarks). + ## Synopsis @@ -194,7 +196,7 @@ Let me know if something's mising ~^ ## Todo -- `haxelib run` command for invoking hxp testscripts +- `haxelib run` command to invoke the hxp testscripts from libfolder - fixing output with leading zeros - optional exponential notation for decimals - optional great letters for hexadecimal output diff --git a/haxelib.json b/haxelib.json index fd67afb..d93c380 100644 --- a/haxelib.json +++ b/haxelib.json @@ -4,9 +4,9 @@ "license": "MIT", "tags": ["math", "arbitrary", "precision", "integer", "bigint"], "description": "pure haxe implementation for arbitrary-precision integer", - "version": "0.1.2", + "version": "0.1.3", "classPath": "src/", - "releasenote": "fixing multiplication and inc-/decrement, adding pi-benchmark", + "releasenote": "little fix of bitsize-macro IntUtil for haxe 4.2", "contributors": ["maitag"], "dependencies": {} } \ No newline at end of file diff --git a/src/IntUtil.hx b/src/IntUtil.hx index 7a96d37..3a92776 100644 --- a/src/IntUtil.hx +++ b/src/IntUtil.hx @@ -25,7 +25,7 @@ class IntUtil else { var bitsize = IntUtil._bitsize(($i:UInt) - 1, $v{maxBitsize >> 1}, $v{maxBitsize >> 1}); if (bitsize >= $v{maxBitsize}) - throw('Error calculating nextPowerOfTwo: reaching maxBitSize of $maxBitsize'); + throw("Error calculating nextPowerOfTwo: reaching maxBitSize of " + $v{maxBitsize}); 1 << bitsize; } ):UInt); @@ -41,7 +41,7 @@ class IntUtil // how to make "private"? (no access from bitsize and _bitsize itself!) public static macro function _bitsize(i:haxe.macro.Expr, n:Int, delta:Int) { if (delta == 0) - return macro throw('Error calculating intBitLength: ' + $i + ' has more bits than maxBitSize'); + return macro throw('Error calculating intBitLength: ' + $i + ' has more bits than maxBitSize of ' + $v{MAX_BITSIZE}); else { delta = delta >> 1; return macro {