From ab17d830d5502188f3b898d1b444e2e6f6145b2e Mon Sep 17 00:00:00 2001 From: flashultra Date: Sun, 22 Dec 2024 14:11:12 +0200 Subject: [PATCH] Fix Cppia II --- std/haxe/math/bigint/MutableBigInt_.hx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/std/haxe/math/bigint/MutableBigInt_.hx b/std/haxe/math/bigint/MutableBigInt_.hx index 2435c890f38..c1ed23670ba 100644 --- a/std/haxe/math/bigint/MutableBigInt_.hx +++ b/std/haxe/math/bigint/MutableBigInt_.hx @@ -48,10 +48,10 @@ class MutableBigInt_ extends BigInt_ { Set the value of this big int with an integer of value `value`. **/ public function setFromInt(value:Int):Void { + ensureCapacity(1, false); #if cppia if ( m_data == null) return; #end - ensureCapacity(1, false); m_data.set(0, value); m_count = 1; } @@ -79,9 +79,6 @@ class MutableBigInt_ extends BigInt_ { if ((value == null) || (value.length < 1)) { throw new BigIntException(BigIntError.INVALID_ARGUMENT); } - #if cppia - if ( m_data == null) return; - #end var negate = value.charCodeAt(0) == 0x2d; var index = negate ? 1 : 0; if (value.length <= index) { @@ -142,6 +139,9 @@ class MutableBigInt_ extends BigInt_ { } var neg = value.get(length - 1) >>> 31; ensureCapacity(length + neg, false); + #if cppia + if ( m_data == null) return; + #end m_data.set(length + neg - 1, 0); MultiwordArithmetic.copy(m_data, value, length); m_count = length + neg;