Ver Fonte

Merge branch 'development' into kt_coro

Simon Krajewski há 1 mês atrás
pai
commit
3a249b0ad2
39 ficheiros alterados com 1478 adições e 314 exclusões
  1. 38 20
      .github/workflows/main.yml
  2. 13 0
      .vscode/schemas/define.schema.json
  3. 8 5
      Makefile
  4. 27 12
      extra/github-actions/build-mac.yml
  5. 11 8
      extra/github-actions/workflows/main.yml
  6. BIN
      extra/mac-installer/installer-structure.pkg
  7. 20 0
      extra/mac-installer/pkg/Distribution
  8. 775 0
      extra/mac-installer/pkg/Resources/en.lproj/License
  9. BIN
      extra/mac-installer/pkg/Resources/en.lproj/background
  10. BIN
      extra/mac-installer/pkg/files.pkg/Bom
  11. 7 0
      extra/mac-installer/pkg/files.pkg/PackageInfo
  12. BIN
      extra/mac-installer/pkg/files.pkg/Scripts
  13. BIN
      extra/mac-installer/pkg/haxeToolkitPreflight.pkg/Bom
  14. 7 0
      extra/mac-installer/pkg/haxeToolkitPreflight.pkg/PackageInfo
  15. BIN
      extra/mac-installer/pkg/haxeToolkitPreflight.pkg/Payload
  16. BIN
      extra/mac-installer/pkg/haxeToolkitPreflight.pkg/Scripts
  17. 3 3
      src-json/define.json
  18. 2 1
      src/context/display/displayJson.ml
  19. 4 1
      src/core/define.ml
  20. 24 0
      src/core/ds/atomicLazy.ml
  21. 4 3
      src/filters/exception/exceptionInit.ml
  22. 8 7
      src/filters/exception/exceptions.ml
  23. 3 2
      src/filters/exception/saveStacks.ml
  24. 10 1
      src/prebuild.ml
  25. 2 2
      src/typing/typeloadParse.ml
  26. 1 0
      std/haxe/display/Display.hx
  27. 3 3
      std/haxe/math/bigint/BigInt.hx
  28. 213 65
      std/haxe/math/bigint/BigIntArithmetic.hx
  29. 4 3
      std/haxe/math/bigint/BigInt_.hx
  30. 100 45
      std/haxe/math/bigint/MutableBigInt_.hx
  31. 5 0
      std/php/Global.hx
  32. 0 1
      tests/Brewfile
  33. 3 0
      tests/misc/projects/Issue12305/compile.hxml
  34. 5 0
      tests/misc/projects/Issue12305/src/Main.hx
  35. 39 0
      tests/misc/projects/Issue12305/src/foo/display/Position.hx
  36. 2 0
      tests/runci/targets/Cpp.hx
  37. 13 8
      tests/runci/targets/Lua.hx
  38. 123 123
      tests/unit/src/unit/TestBigInt.hx
  39. 1 1
      tests/unit/src/unit/TestMain.hx

+ 38 - 20
.github/workflows/main.yml

@@ -535,12 +535,12 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        os: [macos-14, macos-13]
-    runs-on: ${{ matrix.os }}
+        arch: [arm64, x86_64]
+    runs-on: macos-latest
     env:
-      PLATFORM: mac${{ matrix.os == 'macos-14' && '-arm64' || '' }}
+      PLATFORM: mac${{ matrix.arch == 'arm64' && '-arm64' || '' }}
       OPAMYES: 1
-      MACOSX_DEPLOYMENT_TARGET: 10.13
+      MACOSX_DEPLOYMENT_TARGET: ${{ matrix.arch == 'arm64' && 11.0 || 10.13 }}
     steps:
       - uses: actions/checkout@main
         with:
@@ -551,7 +551,7 @@ jobs:
         uses: actions/cache@v4
         with:
           path: ~/.opam/
-          key: ${{ matrix.os }}-${{ env.OCAML_VERSION }}-${{ hashFiles('./haxe.opam', './libs/') }}-1
+          key: macos-${{ matrix.arch }}-${{ env.OCAML_VERSION }}-${{ hashFiles('./haxe.opam', './libs/') }}-1
 
       - name: Install Neko from S3
         run: |
@@ -576,27 +576,42 @@ jobs:
         env:
           # For compatibility with macOS 10.13
           ZLIB_VERSION: 1.3.1
-          MBEDTLS_VERSION: 2.28.5
-          PCRE2_VERSION: 10.42
+          MBEDTLS_VERSION: 2.28.10
+          PCRE2_VERSION: 10.45
+          CMAKE_BUILD_TYPE: Release
+          CMAKE_GENERATOR: Ninja
         run: |
           set -ex
           brew update
           brew bundle --file=tests/Brewfile --no-upgrade
           curl -L https://github.com/madler/zlib/releases/download/v$ZLIB_VERSION/zlib-$ZLIB_VERSION.tar.gz | tar xz
           cd zlib-$ZLIB_VERSION
-          ./configure
-          sudo make && sudo make install
+          cmake -B build -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }}
+          cmake --build build
+          sudo cmake --install build
           cd ..
           curl -L https://github.com/ARMmbed/mbedtls/archive/v$MBEDTLS_VERSION.tar.gz | tar xz
           cd mbedtls-$MBEDTLS_VERSION
-          sudo make && sudo make install
+          cmake -B build -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
+            -DENABLE_TESTING=OFF
+          cmake --build build
+          sudo cmake --install build
           cd ..
           curl -L https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.tar.gz | tar xz
           cd pcre2-$PCRE2_VERSION
-          ./configure --enable-unicode --enable-pcre2-8 --enable-pcre2-16 --enable-pcre2-32 --enable-unicode-properties --enable-pcre2grep-libz --enable-pcre2grep-libbz2 --enable-jit
-          sudo make && sudo make install
+          cmake -B build -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
+            -DPCRE2_SUPPORT_JIT=ON \
+            -DPCRE2_BUILD_TESTS=OFF \
+            -DPCRE2_BUILD_PCRE2GREP=OFF
+          cmake --build build
+          sudo cmake --install build
           cd ..
 
+      - name: Install Opam
+        run: |
+          curl -sSL https://github.com/ocaml/opam/releases/download/2.3.0/opam-2.3.0-${{ matrix.arch }}-macos -o $RUNNER_TEMP/opam
+          sudo install $RUNNER_TEMP/opam /usr/local/bin/opam
+
       - name: Install OCaml libraries
         if: steps.cache-opam.outputs.cache-hit != 'true'
         run: |
@@ -618,22 +633,22 @@ jobs:
         run: |
           set -ex
           eval $(opam env)
-          opam config exec -- make -s STATICLINK=1 "LIB_PARAMS=\"/usr/local/lib/libz.a\" \"/usr/local/lib/libpcre2-8.a\" \"/usr/local/lib/libmbedtls.a\" \"/usr/local/lib/libmbedcrypto.a\" \"/usr/local/lib/libmbedx509.a\"" haxe
-          opam config exec -- make -s haxelib
-          make -s package_unix package_installer_mac
+          opam exec -- make -s STATICLINK=1 "LIB_PARAMS=\"/usr/local/lib/libz.a\" \"/usr/local/lib/libpcre2-8.a\" \"/usr/local/lib/libmbedtls.a\" \"/usr/local/lib/libmbedcrypto.a\" \"/usr/local/lib/libmbedx509.a\"" haxe
+          opam exec -- make -s haxelib
+          opam exec -- make -s package_unix package_installer_mac
           ls -l out
           otool -L ./haxe
           otool -L ./haxelib
 
       - name: Upload artifact (x64)
-        if: runner.arch == 'X64'
+        if: matrix.arch == 'x86_64'
         uses: actions/upload-artifact@v4
         with:
           name: macX64Binaries
           path: out
 
       - name: Upload artifact (arm)
-        if: runner.arch == 'ARM64'
+        if: matrix.arch == 'arm64'
         uses: actions/upload-artifact@v4
         with:
           name: macArmBinaries
@@ -777,19 +792,22 @@ jobs:
 
   mac-test:
     needs: mac-build-universal
-    runs-on: macos-13
+    runs-on: ${{ matrix.os }}
     env:
-      PLATFORM: mac
+      PLATFORM: mac${{ matrix.os == 'macos-latest' && '-arm64' || '' }}
       TEST: ${{matrix.target}}
       HXCPP_COMPILE_CACHE: ~/hxcache
       HAXE_STD_PATH: /usr/local/share/haxe/std
     strategy:
       fail-fast: false
       matrix:
-        target: [macro, js, hl, cpp, jvm, php, python, lua, flash, neko]
+        os: [macos-latest]
+        target: [macro, js, cpp, jvm, php, python, lua, flash, neko]
         include:
           - target: hl
+            os: macos-13
             BREW_PACKAGES: ninja
+
     steps:
       - uses: actions/checkout@main
         with:

+ 13 - 0
.vscode/schemas/define.schema.json

@@ -31,6 +31,7 @@
 						"cpp",
 						"cs",
 						"java",
+						"jvm",
 						"python",
 						"hl",
 						"eval"
@@ -65,6 +66,18 @@
 			"deprecated": {
 				"type": "string",
 				"markdownDescription": "Reason for the define to be deprecated."
+			},
+			"default": {
+				"type": "string",
+				"markdownDescription": "Default value if not explicitly set."
+			},
+			"deprecatedDefine": {
+				"type": "string",
+				"markdownDescription": "Replace and deprecate the given definition name, which can still be used in -D."
+			},
+			"signatureNeutral": {
+				"type": "boolean",
+				"markdownDescription": "Does not affect compilation signature."
 			}
 		},
 		"required": [

+ 8 - 5
Makefile

@@ -95,14 +95,18 @@ endif
 ifeq ($(SYSTEM_NAME),Mac)
 # This assumes that haxelib and neko will both be installed into INSTALL_DIR,
 # which is the case when installing using the mac installer package
-HAXELIB_LFLAGS= -Wl,-rpath,$(INSTALL_DIR)/lib
+NEKO_LIB_PATH=$(INSTALL_DIR)/lib
+endif
+
+ifdef NEKO_LIB_PATH
+HAXELIB_LDFLAGS=-Wl,-rpath,$(NEKO_LIB_PATH)
 endif
 
 haxelib_unix:
 	cd $(CURDIR)/extra/haxelib_src && \
 	HAXE_STD_PATH=$(CURDIR)/std $(CURDIR)/$(HAXE_OUTPUT) client.hxml && \
 	nekotools boot -c run.n
-	$(CC) $(CURDIR)/extra/haxelib_src/run.c -o $(HAXELIB_OUTPUT) -lneko $(HAXELIB_LFLAGS)
+	$(CC) $(CURDIR)/extra/haxelib_src/run.c -o $(HAXELIB_OUTPUT) -lneko $(HAXELIB_LDFLAGS)
 
 # haxelib should depends on haxe, but we don't want to do that...
 ifeq ($(SYSTEM_NAME),Windows)
@@ -200,13 +204,12 @@ package_installer_mac: $(INSTALLER_TMP_DIR)/neko-osx.tar.gz package_unix
 	mv $(INSTALLER_TMP_DIR)/resources/haxe* $(INSTALLER_TMP_DIR)/resources/haxe
 	cd $(INSTALLER_TMP_DIR)/resources && tar -zcvf haxe.tar.gz haxe
 	# scripts
-	cp -rf extra/mac-installer/* $(INSTALLER_TMP_DIR)/resources
+	cp -rf extra/mac-installer/scripts $(INSTALLER_TMP_DIR)/resources
 	sed -i '' 's/%%NEKO_VERSION%%/$(NEKO_VERSION)/g' $(INSTALLER_TMP_DIR)/resources/scripts/neko-postinstall.sh
 	sed -i '' 's/%%NEKO_MAJOR_VERSION%%/$(NEKO_MAJOR_VERSION)/g' $(INSTALLER_TMP_DIR)/resources/scripts/neko-postinstall.sh
 	cd $(INSTALLER_TMP_DIR)/resources && tar -zcvf scripts.tar.gz scripts
 	# installer structure
-	mkdir -p $(INSTALLER_TMP_DIR)/pkg
-	cd $(INSTALLER_TMP_DIR)/pkg && xar -xf ../resources/installer-structure.pkg .
+	cp -rf extra/mac-installer/pkg $(INSTALLER_TMP_DIR)
 	mkdir $(INSTALLER_TMP_DIR)/tgz; mv $(INSTALLER_TMP_DIR)/resources/*.tar.gz $(INSTALLER_TMP_DIR)/tgz
 	cd $(INSTALLER_TMP_DIR)/tgz; find . | cpio -o --format odc | gzip -c > ../pkg/files.pkg/Payload
 	cd $(INSTALLER_TMP_DIR)/pkg/files.pkg && bash -c "INSTKB=$$(du -sk ../../tgz | awk '{print $$1;}'); \

+ 27 - 12
extra/github-actions/build-mac.yml

@@ -2,27 +2,42 @@
   env:
     # For compatibility with macOS 10.13
     ZLIB_VERSION: 1.3.1
-    MBEDTLS_VERSION: 2.28.5
-    PCRE2_VERSION: 10.42
+    MBEDTLS_VERSION: 2.28.10
+    PCRE2_VERSION: 10.45
+    CMAKE_BUILD_TYPE: Release
+    CMAKE_GENERATOR: Ninja
   run: |
     set -ex
     brew update
     brew bundle --file=tests/Brewfile --no-upgrade
     curl -L https://github.com/madler/zlib/releases/download/v$ZLIB_VERSION/zlib-$ZLIB_VERSION.tar.gz | tar xz
     cd zlib-$ZLIB_VERSION
-    ./configure
-    sudo make && sudo make install
+    cmake -B build -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }}
+    cmake --build build
+    sudo cmake --install build
     cd ..
     curl -L https://github.com/ARMmbed/mbedtls/archive/v$MBEDTLS_VERSION.tar.gz | tar xz
     cd mbedtls-$MBEDTLS_VERSION
-    sudo make && sudo make install
+    cmake -B build -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
+      -DENABLE_TESTING=OFF
+    cmake --build build
+    sudo cmake --install build
     cd ..
     curl -L https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.tar.gz | tar xz
     cd pcre2-$PCRE2_VERSION
-    ./configure --enable-unicode --enable-pcre2-8 --enable-pcre2-16 --enable-pcre2-32 --enable-unicode-properties --enable-pcre2grep-libz --enable-pcre2grep-libbz2 --enable-jit
-    sudo make && sudo make install
+    cmake -B build -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
+      -DPCRE2_SUPPORT_JIT=ON \
+      -DPCRE2_BUILD_TESTS=OFF \
+      -DPCRE2_BUILD_PCRE2GREP=OFF
+    cmake --build build
+    sudo cmake --install build
     cd ..
 
+- name: Install Opam
+  run: |
+    curl -sSL https://github.com/ocaml/opam/releases/download/2.3.0/opam-2.3.0-${{ matrix.arch }}-macos -o $RUNNER_TEMP/opam
+    sudo install $RUNNER_TEMP/opam /usr/local/bin/opam
+
 - name: Install OCaml libraries
   if: steps.cache-opam.outputs.cache-hit != 'true'
   run: |
@@ -44,22 +59,22 @@
   run: |
     set -ex
     eval $(opam env)
-    opam config exec -- make -s STATICLINK=1 "LIB_PARAMS=\"/usr/local/lib/libz.a\" \"/usr/local/lib/libpcre2-8.a\" \"/usr/local/lib/libmbedtls.a\" \"/usr/local/lib/libmbedcrypto.a\" \"/usr/local/lib/libmbedx509.a\"" haxe
-    opam config exec -- make -s haxelib
-    make -s package_unix package_installer_mac
+    opam exec -- make -s STATICLINK=1 "LIB_PARAMS=\"/usr/local/lib/libz.a\" \"/usr/local/lib/libpcre2-8.a\" \"/usr/local/lib/libmbedtls.a\" \"/usr/local/lib/libmbedcrypto.a\" \"/usr/local/lib/libmbedx509.a\"" haxe
+    opam exec -- make -s haxelib
+    opam exec -- make -s package_unix package_installer_mac
     ls -l out
     otool -L ./haxe
     otool -L ./haxelib
 
 - name: Upload artifact (x64)
-  if: runner.arch == 'X64'
+  if: matrix.arch == 'x86_64'
   uses: actions/upload-artifact@v4
   with:
     name: macX64Binaries
     path: out
 
 - name: Upload artifact (arm)
-  if: runner.arch == 'ARM64'
+  if: matrix.arch == 'arm64'
   uses: actions/upload-artifact@v4
   with:
     name: macArmBinaries

+ 11 - 8
extra/github-actions/workflows/main.yml

@@ -368,12 +368,12 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        os: [macos-14, macos-13]
-    runs-on: ${{ matrix.os }}
+        arch: [arm64, x86_64]
+    runs-on: macos-latest
     env:
-      PLATFORM: mac${{ matrix.os == 'macos-14' && '-arm64' || '' }}
+      PLATFORM: mac${{ matrix.arch == 'arm64' && '-arm64' || '' }}
       OPAMYES: 1
-      MACOSX_DEPLOYMENT_TARGET: 10.13
+      MACOSX_DEPLOYMENT_TARGET: ${{ matrix.arch == 'arm64' && 11.0 || 10.13 }}
     steps:
       - uses: actions/checkout@main
         with:
@@ -384,7 +384,7 @@ jobs:
         uses: actions/cache@v4
         with:
           path: ~/.opam/
-          key: ${{ matrix.os }}-${{ env.OCAML_VERSION }}-${{ hashFiles('./haxe.opam', './libs/') }}-1
+          key: macos-${{ matrix.arch }}-${{ env.OCAML_VERSION }}-${{ hashFiles('./haxe.opam', './libs/') }}-1
 
       @import install-neko-unix.yml
       @import build-mac.yml
@@ -450,19 +450,22 @@ jobs:
 
   mac-test:
     needs: mac-build-universal
-    runs-on: macos-13
+    runs-on: ${{ matrix.os }}
     env:
-      PLATFORM: mac
+      PLATFORM: mac${{ matrix.os == 'macos-latest' && '-arm64' || '' }}
       TEST: ${{matrix.target}}
       HXCPP_COMPILE_CACHE: ~/hxcache
       HAXE_STD_PATH: /usr/local/share/haxe/std
     strategy:
       fail-fast: false
       matrix:
-        target: [macro, js, hl, cpp, jvm, php, python, lua, flash, neko]
+        os: [macos-latest]
+        target: [macro, js, cpp, jvm, php, python, lua, flash, neko]
         include:
           - target: hl
+            os: macos-13
             BREW_PACKAGES: ninja
+
     steps:
       - uses: actions/checkout@main
         with:

BIN
extra/mac-installer/installer-structure.pkg


+ 20 - 0
extra/mac-installer/pkg/Distribution

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<installer-script minSpecVersion="1.000000" authoringTool="com.apple.PackageMaker" authoringToolVersion="3.0.6" authoringToolBuild="201">
+    <title>Haxe Toolkit %%VERLONG%%</title>
+    <options customize="never" allow-external-scripts="no" hostArchitectures="x86_64,arm64" />
+    <domains enable_localSystem="true"/>
+    <background file="background" alignment="bottomleft" scaling="none"/>
+    <license file="License"/>
+    <choices-outline>
+        <line choice="choice10"/>
+        <line choice="choice8"/>
+    </choices-outline>
+    <choice id="choice10" title="Haxe Toolkit Preflight" start_visible="false">
+        <pkg-ref id="org.haxe.haxeToolkit.preflight.pkg"/>
+    </choice>
+    <choice id="choice8" title="files">
+        <pkg-ref id="org.haxe.haxeToolkit.haxe.pkg"/>
+    </choice>
+    <pkg-ref id="org.haxe.haxeToolkit.preflight.pkg" installKBytes="0" version="1.0" auth="Root">#haxeToolkitPreflight.pkg</pkg-ref>
+    <pkg-ref id="org.haxe.haxeToolkit.haxe.pkg" installKBytes="%%INSTKB%%" version="%%VERSION%%" auth="Root">#files.pkg</pkg-ref>
+</installer-script>

+ 775 - 0
extra/mac-installer/pkg/Resources/en.lproj/License

@@ -0,0 +1,775 @@
+Haxe Licenses
+-------------
+
+For details about Haxe Licenses, please read http://haxe.org/doc/license
+
+The MIT Licence :
+--------------------------
+
+Copyright (C)2005-2012 Haxe Foundation
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+The Haxe compiler GPL License :
+-------------------------------
+
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+
+The Neko LGPL License :
+-----------------------
+
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS

BIN
extra/mac-installer/pkg/Resources/en.lproj/background


BIN
extra/mac-installer/pkg/files.pkg/Bom


+ 7 - 0
extra/mac-installer/pkg/files.pkg/PackageInfo

@@ -0,0 +1,7 @@
+
+<pkg-info format-version="2" identifier="org.haxe.haxeToolkit.haxe.pkg" version="%%VERSION%%" install-location="/tmp/haxe" auth="root">
+    <payload installKBytes="%%INSTKB%%" numberOfFiles="5"/>
+    <scripts>
+        <postinstall file="./postinstall"/>
+    </scripts>
+</pkg-info>

BIN
extra/mac-installer/pkg/files.pkg/Scripts


BIN
extra/mac-installer/pkg/haxeToolkitPreflight.pkg/Bom


+ 7 - 0
extra/mac-installer/pkg/haxeToolkitPreflight.pkg/PackageInfo

@@ -0,0 +1,7 @@
+
+<pkg-info format-version="2" identifier="org.haxe.haxeToolkit.preflight.pkg" version="1.0" install-location="/" auth="root">
+    <payload installKBytes="0" numberOfFiles="1"/>
+    <scripts>
+        <preinstall file="./preflight"/>
+    </scripts>
+</pkg-info>

BIN
extra/mac-installer/pkg/haxeToolkitPreflight.pkg/Payload


BIN
extra/mac-installer/pkg/haxeToolkitPreflight.pkg/Scripts


+ 3 - 3
src-json/define.json

@@ -303,14 +303,14 @@
 	},
 	{
 		"name": "HaxeOutputFile",
-		"define": "HAXE_OUTPUT_FILE",
+		"define": "HAXE-OUTPUT-FILE",
 		"doc": "Force the full output name of the executable/library without library prefix and debug suffix.",
 		"platforms": ["cpp"],
 		"params": ["name"]
 	},
 	{
 		"name": "HaxeOutputPart",
-		"define": "HAXE_OUTPUT_PART",
+		"define": "HAXE-OUTPUT-PART",
 		"doc": "Output name of the executable/library. (default: main class name)",
 		"platforms": ["cpp"],
 		"params": ["name"]
@@ -508,7 +508,7 @@
 	},
 	{
 		"name": "JsGlobal",
-		"define": "js_global",
+		"define": "js-global",
 		"doc": "Customizes the global object name.",
 		"platforms": ["js"]
 	},

+ 2 - 1
src/context/display/displayJson.ml

@@ -303,7 +303,8 @@ let handler =
 							| UserDefined (Some o) -> o
 						);
 						"deprecated", jopt jstring data.d_deprecated;
-						"links", jarray (List.map jstring data.d_links)
+						"links", jarray (List.map jstring data.d_links);
+						"reserved", jopt jbool data.d_reserved
 					] in
 
 					(jobject fields)

+ 4 - 1
src/core/define.ml

@@ -32,17 +32,19 @@ type define_infos = {
 	d_links : string list;
 	d_deprecated : string option;
 	d_default : string option;
+	d_reserved : bool option;
 }
 
 let infos ?user_defines d =
 	let extract_infos (t, (doc, flags), origin) =
-		let params = ref [] and pfs = ref [] and links = ref [] and deprecated = ref None and default = ref None in
+		let params = ref [] and pfs = ref [] and links = ref [] and deprecated = ref None and default = ref None and reserved = ref None in
 		List.iter (function
 			| HasParam s -> params := s :: !params
 			| Platforms fl -> pfs := fl @ !pfs
 			| Link url -> links := url :: !links
 			| Deprecated s -> deprecated := Some s
 			| DefaultValue s -> default := Some s
+			| Reserved b -> reserved := Some b
 		) flags;
 		(t, {
 			d_doc = doc;
@@ -52,6 +54,7 @@ let infos ?user_defines d =
 			d_links = !links;
 			d_deprecated = !deprecated;
 			d_default = !default;
+			d_reserved = !reserved;
 		})
 	in
 

+ 24 - 0
src/core/ds/atomicLazy.ml

@@ -0,0 +1,24 @@
+open Atomic
+
+type 'a t = {
+	mutable value: 'a option;
+	mutex: Mutex.t;
+	compute: unit->'a
+}
+
+let from_fun f =
+	{ value = None; mutex = Mutex.create (); compute = (fun () -> f()) }
+
+let force lazy_val =
+	match lazy_val.value with
+		| None ->
+			Mutex.protect lazy_val.mutex (fun () ->
+				match lazy_val.value with
+					| None ->
+						let result = lazy_val.compute () in
+						lazy_val.value <- Some result;
+						result
+					| Some result -> result
+			)
+		| Some v -> v
+

+ 4 - 3
src/filters/exception/exceptionInit.ml

@@ -6,6 +6,7 @@ open Exceptions
 open Type
 open Typecore
 open ExceptionFunctions
+open AtomicLazy
 
 let create_exception_context tctx =
 	match tctx.com.platform with (* TODO: implement for all targets *)
@@ -28,15 +29,15 @@ let create_exception_context tctx =
 			let t = Typeload.load_instance tctx (tp config.ec_base_throw) ParamSpawnMonos LoadNormal in
 			if is_dynamic t then t_dynamic
 			else t
-		and haxe_exception = Lazy.from_fun (fun () ->
+		and haxe_exception = AtomicLazy.from_fun (fun () ->
 			match Typeload.load_instance tctx (tp haxe_exception_type_path) ParamSpawnMonos LoadNormal with
 			| TInst(cls,_) as t -> t,cls
 			| _ -> raise_typing_error "haxe.Exception is expected to be a class" null_pos)
-		and value_exception = Lazy.from_fun (fun () ->
+		and value_exception = AtomicLazy.from_fun (fun () ->
 			match Typeload.load_instance tctx (tp value_exception_type_path) ParamSpawnMonos LoadNormal with
 			| TInst(cls,_) as t -> t,cls
 			| _ -> raise_typing_error "haxe.ValueException is expected to be a class" null_pos)
-		and haxe_native_stack_trace = Lazy.from_fun (fun () ->
+		and haxe_native_stack_trace = AtomicLazy.from_fun (fun () ->
 			match Typeload.load_instance tctx (tp (["haxe"],"NativeStackTrace")) ParamSpawnMonos LoadNormal with
 			| TInst(cls,_) -> cls
 			| TAbstract({ a_impl = Some cls },_) -> cls

+ 8 - 7
src/filters/exception/exceptions.ml

@@ -3,6 +3,7 @@ open Type
 open PlatformConfig
 open Error
 open ExceptionFunctions
+open AtomicLazy
 
 type context = {
 	scom : SafeCom.t;
@@ -12,32 +13,32 @@ type context = {
 	base_throw_type : Type.t;
 	throws_anything : bool;
 	catches_anything : bool;
-	haxe_exception : (Type.t * tclass) Lazy.t;
-	haxe_native_stack_trace : tclass Lazy.t;
-	value_exception : (Type.t * tclass) Lazy.t;
+	haxe_exception : (Type.t * tclass) AtomicLazy.t;
+	haxe_native_stack_trace : tclass AtomicLazy.t;
+	value_exception : (Type.t * tclass) AtomicLazy.t;
 	is_of_type : (tclass * tclass_field * Type.t);
 }
 
 let haxe_exception_class ctx =
-	let cls = snd (Lazy.force ctx.haxe_exception) in
+	let cls = snd (AtomicLazy.force ctx.haxe_exception) in
 	assert (ctx.scom.curclass != null_class);
 	add_dependency ctx.scom.curclass.cl_module cls.cl_module MDepFromTyping;
 	cls
 
 let haxe_exception_type ctx =
-	let t,cls = Lazy.force ctx.haxe_exception in
+	let t,cls = AtomicLazy.force ctx.haxe_exception in
 	assert (ctx.scom.curclass != null_class);
 	add_dependency ctx.scom.curclass.cl_module cls.cl_module MDepFromTyping;
 	t
 
 let value_exception_class ctx =
-	let cls = snd (Lazy.force ctx.value_exception) in
+	let cls = snd (AtomicLazy.force ctx.value_exception) in
 	assert (ctx.scom.curclass != null_class);
 	add_dependency ctx.scom.curclass.cl_module cls.cl_module MDepFromTyping;
 	cls
 
 let value_exception_type ctx =
-	let t,cls = Lazy.force ctx.value_exception in
+	let t,cls = AtomicLazy.force ctx.value_exception in
 	assert (ctx.scom.curclass != null_class);
 	add_dependency ctx.scom.curclass.cl_module cls.cl_module MDepFromTyping;
 	t

+ 3 - 2
src/filters/exception/saveStacks.ml

@@ -4,6 +4,7 @@ open Type
 open Error
 open ExceptionFunctions
 open Exceptions
+open AtomicLazy
 
 (**
 	Inserts `haxe.NativeStackTrace.saveStack(e)` in non-haxe.Exception catches.
@@ -20,7 +21,7 @@ let insert_save_stacks ectx scom =
 			check_expr contains_insertion_points e
 	in
 	let save_exception_stack catch_var =
-		let native_stack_trace_cls = Lazy.force ectx.haxe_native_stack_trace in
+		let native_stack_trace_cls = AtomicLazy.force ectx.haxe_native_stack_trace in
 		let method_field =
 			try PMap.find "saveStack" native_stack_trace_cls.cl_statics
 			with Not_found -> raise_typing_error ("haxe.NativeStackTrace has no field saveStack") catch_var.v_pos
@@ -65,7 +66,7 @@ let insert_save_stacks ectx scom =
 	Adds `this.__shiftStack()` calls to constructors of classes which extend `haxe.Exception`
 *)
 let patch_constructors ectx =
-	match fst (Lazy.force ectx.haxe_exception) with
+	match fst (AtomicLazy.force ectx.haxe_exception) with
 	(* Add only if `__shiftStack` method exists *)
 	| TInst(cls,_) when PMap.mem "__shiftStack" cls.cl_fields ->
 		(fun mt ->

+ 10 - 1
src/prebuild.ml

@@ -116,6 +116,7 @@ type parsed_define = {
 	d_deprecated_define : string option;
 	d_default : string option;
 	d_signature_neutral : bool option;
+	d_reserved : bool option;
 }
 let parse_define json =
 	let fields = match json with
@@ -133,6 +134,7 @@ let parse_define json =
 		d_deprecated_define = get_optional_field2 "deprecatedDefine" as_string fields;
 		d_default = get_optional_field2 "default" as_string fields;
 		d_signature_neutral = get_optional_field2 "signatureNeutral" as_bool fields;
+		d_reserved = get_optional_field2 "reserved" as_bool fields;
 	}
 
 let parse_meta json =
@@ -236,6 +238,12 @@ let gen_define_info defines =
 					DynArray.add default_values (Printf.sprintf "\t(%S,%S)" define x);
 					[Printf.sprintf "DefaultValue(%s)" quoted]
 			in
+			let reserved = match def.d_reserved with
+				| None ->
+					[]
+				| Some b ->
+					[Printf.sprintf "Reserved(%b)" b]
+			in
 			(match def.d_signature_neutral with
 				| Some true ->
 					DynArray.add sig_neutral (Printf.sprintf "| %S" (convert_define define));
@@ -244,7 +252,7 @@ let gen_define_info defines =
 					| Some s -> DynArray.add sig_neutral (Printf.sprintf "| %S" (convert_define s))
 					end
 				| _ -> ());
-			"\t| " ^ def.d_name ^ " -> \"" ^ define ^ "\",(" ^ (Printf.sprintf "%S" def.d_doc) ^ ",[" ^ (String.concat "; " (platforms_str @ params_str @ links_str @ deprecated @ default)) ^ "])"
+			"\t| " ^ def.d_name ^ " -> \"" ^ define ^ "\",(" ^ (Printf.sprintf "%S" def.d_doc) ^ ",[" ^ (String.concat "; " (platforms_str @ params_str @ links_str @ deprecated @ default @ reserved )) ^ "])"
 	) defines in
 	(
 		String.concat "\n" define_str,
@@ -326,6 +334,7 @@ type define_parameter =
 	| Link of string
 	| Deprecated of string
 	| DefaultValue of string
+	| Reserved of bool
 
 type define_deprecation =
 	| DueTo of string

+ 2 - 2
src/typing/typeloadParse.ml

@@ -325,9 +325,9 @@ let parse_module com m p =
 										TPType (make_ptp_th_null (mk_type_path ([],fst tp.tp_name)))
 									) d.d_params
 								in
-								mk_type_path ~params (!remap,fst d.d_name)
+								mk_type_path ~params ~sub:(fst d.d_name) (!remap,snd m)
 						in
-						make_ptp_th_null tp
+						make_ptp_th tp (snd d.d_name)
 					end
 				},p) :: acc
 			in

+ 1 - 0
std/haxe/display/Display.hx

@@ -322,6 +322,7 @@ typedef Define = {
 	var links:Array<String>;
 	var ?origin:String;
 	var ?deprecated:String;
+	var ?reserved:Bool;
 }
 
 typedef Keyword = {

+ 3 - 3
std/haxe/math/bigint/BigInt.hx

@@ -170,13 +170,13 @@ abstract BigInt(BigInt_) {
 	}
 
 	/**
-		Creates a `BigInt` from a hexadecimal string. Assumes signed representation.
-		This is a shorthand for `fromHexSigned(value)`.
+		Creates a `BigInt` from a hexadecimal string. Assumes unsigned representation.
+		This is a shorthand for `fromHexUnsigned(value)`.
 		@param value The hexadecimal string.
 		@return A new `BigInt` instance.
 	**/
 	public static inline function fromHex(value:String):BigInt {
-		return fromHexSigned(value);
+		return fromHexUnsigned(value);
 	}
 
 	/**

+ 213 - 65
std/haxe/math/bigint/BigIntArithmetic.hx

@@ -42,7 +42,7 @@ class BigIntArithmetic {
 	**/
 	public static function compareInt(a:BigInt_, b:Int):Int {
 		if (a.m_count > 1) {
-			return (a.sign() << 1) + 1;
+			return a.sign();
 		}
 		var x:Int = a.m_data.get(0);
 		var lt:Int = (x - b) ^ ((x ^ b) & ((x - b) ^ x)); // "Hacker's Delight" p. 23
@@ -59,20 +59,20 @@ class BigIntArithmetic {
 	**/
 	public static function compare(a:BigInt_, b:BigInt_):Int {
 		if (a != b) {
-			var c:Int = (a.sign() & 2) + (b.sign() & 1);
+			var c:Int = (a.sign() & 7) + (b.sign() & 3);
 			switch (c) {
-				case 0: // a and b are positive
+				case 1, 2: // a and b are positive
 					if (a.m_count > b.m_count) {
 						return 1;
 					}
 					if (a.m_count < b.m_count) {
 						return -1;
 					}
-				case 1: // a is positive, b is negative
+				case 3, 4: // a is positive, b is negative
 					return 1;
-				case 2: // a is negative, b is positive
+				case 7, 8: // a is negative, b is positive
 					return -1;
-				case 3: // a and b are negative
+				case 10: // a and b are negative
 					if (a.m_count > b.m_count) {
 						return -1;
 					}
@@ -137,7 +137,7 @@ class BigIntArithmetic {
 			var o1 = (operand1.m_count > operand2.m_count) ? operand1 : operand2;
 			var o2 = (operand1.m_count > operand2.m_count) ? operand2 : operand1;
 			result.ensureCapacity(o1.m_count + 1, (result == operand1) || (result == operand2));
-			var s:Int = o2.sign();
+			var s:Int = (o2.sign() == -1) ? -1 : 0;
 			for (i in 0...o2.m_count) {
 				x = o1.m_data.get(i);
 				y = o2.m_data.get(i);
@@ -226,7 +226,7 @@ class BigIntArithmetic {
 		} else if (operand1.m_count > operand2.m_count) {
 			// operand1 is longer
 			result.ensureCapacity(operand1.m_count + 1, (result == operand1) || (result == operand2));
-			var s:Int = operand2.sign();
+			var s:Int = (operand2.sign() == -1) ? -1 : 0;
 			for (i in 0...operand2.m_count) {
 				x = operand1.m_data.get(i);
 				y = operand2.m_data.get(i);
@@ -245,7 +245,7 @@ class BigIntArithmetic {
 		} else {
 			// operand2 is longer
 			result.ensureCapacity(operand2.m_count + 1, (result == operand1) || (result == operand2));
-			var s:Int = operand1.sign();
+			var s:Int = (operand1.sign() == -1) ? -1 : 0;
 			for (i in 0...operand1.m_count) {
 				x = operand1.m_data.get(i);
 				y = operand2.m_data.get(i);
@@ -333,7 +333,7 @@ class BigIntArithmetic {
 		or `operand2`; however, `operand1` and `operand2` may be the
 		same object.
 	**/
-	public static function multiply(result:MutableBigInt_, operand1:BigInt_, operand2:BigInt_):Void {
+	private static function multiplyTraditional(result:MutableBigInt_, operand1:BigInt_, operand2:BigInt_):Void {
 		// Implements Figure 8-1 (p. 172) from "Hacker's Delight", Second Edition; Henry S. Warren, Jr.; 2013.
 
 		if ((operand1 == result) || (operand2 == result)) {
@@ -345,11 +345,6 @@ class BigIntArithmetic {
 			return;
 		}
 
-		if ((operand1.bitLength() >= 2500) && (operand2.bitLength() >= 2500)) {
-			multiplyKaratsuba(result, operand1, operand2);
-			return;
-		}
-
 		var resultSize:Int = operand1.m_count + operand2.m_count;
 		result.ensureCapacity(resultSize, false); // always overwrite result
 		for (i in 0...resultSize) {
@@ -437,7 +432,17 @@ class BigIntArithmetic {
 	**/
 	public static function divide(dividend:BigInt_, divisor:BigInt_, quotientOut:MutableBigInt_, remainderOut:MutableBigInt_,
 			work:MutableBigInt_ = null):Void {
-		var c:Int = (dividend.sign() & 2) + (divisor.sign() & 1);
+		var dividendSign = dividend.sign();
+		var divisorSign = divisor.sign();
+
+		// Create a combined case value: 0 = both positive, 1 = dividend positive/divisor negative,
+		// 2 = dividend negative/divisor positive, 3 = both negative
+		var c:Int = 0;
+		if (dividendSign == -1)
+			c += 2;
+		if (divisorSign == -1)
+			c += 1;
+			
 		switch (c) {
 			case 0: // dividend positive, divisor positive
 				multiwordUnsignedDivide(dividend, divisor, quotientOut, remainderOut, work);
@@ -580,7 +585,7 @@ class BigIntArithmetic {
 		var whole:Int = operand2 >> 5; // whole digits portion
 		var n:Int = operand2 & 0x1f; // sub digit poortion
 		if (whole >= operand1.m_count) {
-			result.m_data.set(0, operand1.sign());
+			result.m_data.set(0, (operand1.sign() == -1) ? -1 : 0);
 			result.m_count = 1;
 		} else if (n > 0) {
 			MultiwordArithmetic._asr32(result.m_data, operand1.m_data, operand1.m_count, whole, n);
@@ -615,9 +620,9 @@ class BigIntArithmetic {
 	public static inline function bitwiseAnd(operand1:BigInt_, operand2:BigInt_):BigInt_ {
 		var result:MutableBigInt_ = new MutableBigInt_();
 		if ((operand1.m_count > operand2.m_count)) {
-			result.m_count = (operand2.sign() == 0) ? operand2.m_count : operand1.m_count;
+			result.m_count = (operand2.sign() == 1) ? operand2.m_count : operand1.m_count;
 		} else {
-			result.m_count = (operand1.sign() == 0) ? operand1.m_count : operand2.m_count;
+			result.m_count = (operand1.sign() == 1) ? operand1.m_count : operand2.m_count;
 		}
 		result.ensureCapacity(result.m_count, false);
 		for (i in 0...result.m_count) {
@@ -640,8 +645,8 @@ class BigIntArithmetic {
 		var result:MutableBigInt_ = new MutableBigInt_();
 		result.m_count = (operand1.m_count > operand2.m_count) ? operand1.m_count : operand2.m_count;
 		result.ensureCapacity(result.m_count, false);
-		var operand1Positive:Bool = operand1.sign() == 0;
-		var operand2Positive:Bool = operand2.sign() == 0;
+		var operand1Positive:Bool = operand1.sign() == 1;
+		var operand2Positive:Bool = operand2.sign() == 1;
 		for (i in 0...result.m_count) {
 			if (i > (operand1.m_count - 1)) {
 				result.m_data.set(i, (operand1Positive ? operand2.m_data.get(i) : 0xffffffff));
@@ -663,8 +668,8 @@ class BigIntArithmetic {
 		var result:MutableBigInt_ = new MutableBigInt_();
 		result.m_count = (operand1.m_count > operand2.m_count) ? operand1.m_count : operand2.m_count;
 		result.ensureCapacity(result.m_count, false);
-		var operand1Positive:Bool = operand1.sign() == 0;
-		var operand2Positive:Bool = operand2.sign() == 0;
+		var operand1Positive:Bool = operand1.sign() == 1;
+		var operand2Positive:Bool = operand2.sign() == 1;
 		for (i in 0...result.m_count) {
 			if (i > (operand1.m_count - 1)) {
 				result.m_data.set(i, (operand1Positive ? operand2.m_data.get(i) : (operand2.m_data.get(i) ^ 0xffffffff)));
@@ -701,47 +706,6 @@ class BigIntArithmetic {
 		return (input.m_count << 5) - BigIntHelper.nlz(input.m_data.get(input.m_count - 1));
 	}
 
-	/**
-		Multiply two big integers using the Karatsuba algorithm for performance.
-		@param result The `MutableBigInt_` to store the product.
-		@param x The first operand.
-		@param y The second operand.
-	**/
-	public static function multiplyKaratsuba(result:MutableBigInt_, x:BigInt_, y:BigInt_):Void {
-		var n = (x.bitLength() > y.bitLength()) ? x.bitLength() : y.bitLength();
-		if (n < 2500) {
-			multiply(result, x, y);
-			return;
-		}
-		n = (n + 1) >> 1;
-		var b = new MutableBigInt_();
-		arithmeticShiftRight(b, x, n);
-		var a = new MutableBigInt_();
-		arithmeticShiftLeft(a, b, n);
-		subtract(a, x, a);
-		var d = new MutableBigInt_();
-		arithmeticShiftRight(d, y, n);
-		var c = new MutableBigInt_();
-		arithmeticShiftLeft(c, d, n);
-		subtract(c, y, c);
-		var ac = new MutableBigInt_();
-		multiplyKaratsuba(ac, a, c);
-		var bd = new MutableBigInt_();
-		multiplyKaratsuba(bd, b, d);
-		var abcd = new MutableBigInt_();
-		add(a, a, b);
-		add(c, c, d);
-		multiplyKaratsuba(abcd, a, c);
-		var op1 = new MutableBigInt_();
-		arithmeticShiftLeft(op1, bd, 2 * n);
-		var op2 = new MutableBigInt_();
-		subtract(op2, abcd, ac);
-		subtract(op2, op2, bd);
-		arithmeticShiftLeft(op2, op2, n);
-		add(op2, ac, op2);
-		add(result, op1, op2);
-	}
-
 	//-----------------------------------------------------------------------
 	// Private helpers
 	//-----------------------------------------------------------------------
@@ -794,4 +758,188 @@ class BigIntArithmetic {
 			output.set(outputOffset + i, input.get(inputOffset + i));
 		}
 	}
-}
+	
+	private static function nextPowerOfTwo(value:Int):Int {
+		if (value <= 0)
+			return 1;
+		value--;
+		value |= value >> 1;
+		value |= value >> 2;
+		value |= value >> 4;
+		value |= value >> 8;
+		value |= value >> 16;
+		return value + 1;
+	}
+
+	private static function splitAtPowerOfTwo(value:BigInt_, splitBits:Int, high:MutableBigInt_, low:MutableBigInt_):Void {
+		if (splitBits <= 0) {
+			high.setFromInt(0);
+			low.copyFrom(value);
+			return;
+		}
+
+		var wordBoundary:Int = splitBits >> 5;
+		var bitOffset:Int = splitBits & 0x1f; // modulo 32
+
+		if (wordBoundary >= value.m_count) {
+			high.setFromInt(0);
+			low.copyFrom(value);
+			return;
+		}
+
+		low.ensureCapacity(wordBoundary + 1, false);
+
+		// Copy the lower words
+		for (i in 0...wordBoundary) {
+			low.m_data.set(i, value.m_data.get(i));
+		}
+
+		if (bitOffset > 0 && wordBoundary < value.m_count) {
+			var mask:Int = (1 << bitOffset) - 1;
+			low.m_data.set(wordBoundary, value.m_data.get(wordBoundary) & mask);
+			low.m_count = wordBoundary + 1;
+		} else {
+			low.m_count = wordBoundary;
+		}
+		
+		// Ensure low part is always treated as positive
+		// by adding a leading zero if the most significant bit is set
+		if (low.m_count > 0 && low.m_data.get(low.m_count - 1) < 0) {
+			low.ensureCapacity(low.m_count + 1, false);
+			low.m_data.set(low.m_count, 0);
+			low.m_count++;
+		}
+		
+		low.compact();
+
+		BigIntArithmetic.arithmeticShiftRight(high, value, splitBits);
+	}
+	
+	public static function multiply(result:MutableBigInt_, operand1:BigInt_, operand2:BigInt_):Void {
+		if ((operand1 == result) || (operand2 == result)) {
+			throw new BigIntException(BigIntError.INVALID_ARGUMENT);
+		}
+
+		if (operand1.isZero() || operand2.isZero()) {
+			result.setFromInt(0);
+			return;
+		}
+
+		var bitLength1 = operand1.bitLength();
+		var bitLength2 = operand2.bitLength();
+
+		if (bitLength1 < 512 || bitLength2 < 512) {
+			BigIntArithmetic.multiplyTraditional(result, operand1, operand2);
+			return;
+		}
+
+		var maxBits = (bitLength1 > bitLength2) ? bitLength1 : bitLength2;
+		var splitBits = nextPowerOfTwo(maxBits >> 1);
+
+		if (splitBits < 256)
+			splitBits = 256;
+
+		multiplyKaratsuba(result, operand1, operand2, splitBits);
+	}
+	
+	private static function multiplyKaratsuba(result:MutableBigInt_, x:BigInt_, y:BigInt_, splitBits:Int):Void {
+		if (x.bitLength() < 512 || y.bitLength() < 512) {
+			BigIntArithmetic.multiplyTraditional(result, x, y);
+			return;
+		}
+
+		var x1 = new MutableBigInt_();
+		var x0 = new MutableBigInt_();
+		splitAtPowerOfTwo(x, splitBits, x1, x0);
+
+		var y1 = new MutableBigInt_();
+		var y0 = new MutableBigInt_();
+		splitAtPowerOfTwo(y, splitBits, y1, y0);
+
+		var z2 = new MutableBigInt_(); // x1 * y1
+		var z0 = new MutableBigInt_(); // x0 * y0
+		var z1 = new MutableBigInt_(); // (x1 + x0) * (y1 + y0) - z2 - z0
+
+		//  z2 = x1 * y1
+		multiplyKaratsuba(z2, x1, y1, splitBits >> 1);
+
+		//  z0 = x0 * y0
+		multiplyKaratsuba(z0, x0, y0, splitBits >> 1);
+
+		//  z1 = (x1 + x0) * (y1 + y0) - z2 - z0
+		var sum_x = new MutableBigInt_();
+		var sum_y = new MutableBigInt_();
+		BigIntArithmetic.add(sum_x, x1, x0);
+		BigIntArithmetic.add(sum_y, y1, y0);
+
+		multiplyKaratsuba(z1, sum_x, sum_y, splitBits >> 1);
+		BigIntArithmetic.subtract(z1, z1, z2);
+		BigIntArithmetic.subtract(z1, z1, z0);
+
+		// result = z2 * 2^(2*splitBits) + z1 * 2^splitBits + z0
+		var temp1 = new MutableBigInt_();
+		var temp2 = new MutableBigInt_();
+
+		// z2 * 2^(2*splitBits)
+		BigIntArithmetic.arithmeticShiftLeft(temp1, z2, 2 * splitBits);
+
+		// z1 * 2^splitBits
+		BigIntArithmetic.arithmeticShiftLeft(temp2, z1, splitBits);
+
+		BigIntArithmetic.add(result, temp1, temp2);
+		BigIntArithmetic.add(result, result, z0);
+	}
+	
+	/**
+		Squaring operation using power-of-two splitting.
+		@param result The output BigInt for the square
+		@param operand The operand to square
+	**/
+	public static function square(result:MutableBigInt_, operand:BigInt_):Void {
+		if (operand == result) {
+			throw new BigIntException(BigIntError.INVALID_ARGUMENT);
+		}
+
+		if (operand.isZero()) {
+			result.setFromInt(0);
+			return;
+		}
+
+		var bitLength = operand.bitLength();
+
+		if (bitLength < 512) {
+			BigIntArithmetic.multiplyTraditional(result, operand, operand);
+			return;
+		}
+
+		var splitBits = nextPowerOfTwo(bitLength >> 1);
+		if (splitBits < 256)
+			splitBits = 256;
+
+		var high = new MutableBigInt_();
+		var low = new MutableBigInt_();
+		splitAtPowerOfTwo(operand, splitBits, high, low);
+
+		// Calculate (high + low)^2 = high^2 + 2*high*low + low^2
+		var highSquared = new MutableBigInt_();
+		var lowSquared = new MutableBigInt_();
+		var crossProduct = new MutableBigInt_();
+
+		square(highSquared, high);
+		square(lowSquared, low);
+
+		// Calculate 2 * high * low
+		multiplyKaratsuba(crossProduct, high, low, splitBits >> 1);
+		BigIntArithmetic.arithmeticShiftLeft(crossProduct, crossProduct, 1);
+
+		// Combine results: result = high^2 * 2^(2*splitBits) + 2*high*low * 2^splitBits + low^2
+		var temp1 = new MutableBigInt_();
+		var temp2 = new MutableBigInt_();
+
+		BigIntArithmetic.arithmeticShiftLeft(temp1, highSquared, 2 * splitBits);
+		BigIntArithmetic.arithmeticShiftLeft(temp2, crossProduct, splitBits);
+
+		BigIntArithmetic.add(result, temp1, temp2);
+		BigIntArithmetic.add(result, result, lowSquared);
+	}
+}

+ 4 - 3
std/haxe/math/bigint/BigInt_.hx

@@ -123,10 +123,11 @@ class BigInt_ {
 
 	/**
 		Retrieve the sign value of this big integer.
-		@return 0 if positive or zero, -1 if negative.
+		@return 1 if positive , 0 if zero, -1 if negative.
 	**/
 	public inline function sign():Int {
-		return (m_data.get(m_count - 1) >> 31 != 0) ? -1 : 0;
+		if ( m_count == 1 && m_data.get(0) == 0) return 0;
+		return (m_data.get(m_count - 1) >> 31 != 0) ? -1 : 1;
 	}
 
 	/**
@@ -514,7 +515,7 @@ class BigInt_ {
 	**/
 	public function square():BigInt_ {
 		var r:MutableBigInt_ = new MutableBigInt_();
-		BigIntArithmetic.multiply(r, this, this);
+		BigIntArithmetic.square(r, this);
 		return r;
 	}
 

+ 100 - 45
std/haxe/math/bigint/MutableBigInt_.hx

@@ -81,43 +81,57 @@ class MutableBigInt_ extends BigInt_ {
 		if ((value == null) || (value.length < 1)) {
 			throw new BigIntException(BigIntError.INVALID_ARGUMENT);
 		}
-		var negate = value.charCodeAt(0) == 0x2d;
+
+		var negate = value.charCodeAt(0) == 0x2d; // '-' character
 		var index = negate ? 1 : 0;
+
 		if (value.length <= index) {
 			throw new BigIntException(BigIntError.INVALID_ARGUMENT);
 		}
-		if ( value.charCodeAt(index) ==  0x30) {
-			if ( value.charCodeAt(index+1) ==  0x62 ) { // binary
+
+		if (value.charCodeAt(index) == 0x30) { // '0'
+			if (value.charCodeAt(index + 1) == 0x62) { // 'b' - binary
 				radix = 2;
-				index +=2;
-			} else if ( value.charCodeAt(index+1) ==  0x6F ) { //octal
+				index += 2;
+			} else if (value.charCodeAt(index + 1) == 0x6F) { // 'o' - octal
 				radix = 8;
-				index +=2;
-			} else if ( value.charCodeAt(index+1) ==  0x78 ) { // hex
-				setFromHexSigned((negate?"-":"")+value.substr(index+2));
+				index += 2;
+			} else if (value.charCodeAt(index + 1) == 0x78) { // 'x' - hex
+				_setFromHex(value.substr(index + 2), false);
+				if (negate) {
+					BigIntArithmetic.negate(this, this);
+				}
 				return;
 			}
 		}
-		if (radix == 16) { 
-			setFromHexSigned(value);
+
+		if (radix == 16) {
+			_setFromHex(value.substr(index), false);
+			if (negate) {
+				BigIntArithmetic.negate(this, this);
+			}
 			return;
 		}
+
 		this.setFromInt(0);
 		var t = new MutableBigInt_();
 		var endDigit:Int = 57;
-		var extraEndDigit:Int=0;
-		if (  radix <= 10 ) {
-			endDigit =  48 + radix-1;
+		var extraEndDigit:Int = 0;
+
+		if (radix <= 10) {
+			endDigit = 48 + radix - 1;
 		} else {
-			extraEndDigit =  radix-11;
+			extraEndDigit = radix - 11;
 		}
+
 		for (i in index...value.length) {
 			var c = value.charCodeAt(i);
-			if ( ((48 <= c) && (c <= endDigit)) || (radix > 10 && ( (65<=c && c<=(65+extraEndDigit)) || (97<=c && c<=(97+extraEndDigit)) ) ) ) {
+			if (((48 <= c) && (c <= endDigit))
+				|| (radix > 10 && ((65 <= c && c <= (65 + extraEndDigit)) || (97 <= c && c <= (97 + extraEndDigit))))) {
 				BigIntArithmetic.multiplyInt(t, this, radix);
-				if ( c <= endDigit) {
+				if (c <= endDigit) {
 					BigIntArithmetic.addInt(this, t, c - 48);
-				} else if (c<=(65+extraEndDigit)) {
+				} else if (c <= (65 + extraEndDigit)) {
 					BigIntArithmetic.addInt(this, t, c - 55);
 				} else {
 					BigIntArithmetic.addInt(this, t, c - 87);
@@ -126,6 +140,7 @@ class MutableBigInt_ extends BigInt_ {
 				throw new BigIntException(BigIntError.INVALID_ARGUMENT);
 			}
 		}
+
 		if (negate) {
 			BigIntArithmetic.negate(this, this);
 		}
@@ -420,46 +435,86 @@ class MutableBigInt_ extends BigInt_ {
 		if (value == null) {
 			throw new BigIntException(BigIntError.INVALID_ARGUMENT);
 		}
+
 		var index = value.length;
 		if (index <= 0) {
 			throw new BigIntException(BigIntError.INVALID_ARGUMENT);
 		}
+
+		var hexDigitCount = 0;
+		for (i in 0...index) {
+			var c = value.charCodeAt(i);
+			if (c != 32) { // check for a space
+				hexDigitCount++;
+			}
+		}
+
+		var wordsNeeded = (hexDigitCount + 7) >> 3;
+
+		// For unsigned, we need an extra word if the top bit is set
 		var extra:Int = signed ? 0 : 1;
-		ensureCapacity(((index + 7) >> 3) + extra, false);
-		var pos = -1;
-		var bit:Int = 32;
-		var c:Int32 = 0;
-		while (index > 0) {
-			c = value.charCodeAt(--index);
-			if ((48 <= c) && (c <= 57)) {
-				c -= 48;
-			} else if ((65 <= c) && (c <= 70)) {
-				c -= 55;
-			} else if ((97 <= c) && (c <= 102)) {
-				c -= 87;
-			} else if (c == 32) {
+		ensureCapacity(wordsNeeded + extra, false);
+
+		for (i in 0...wordsNeeded + extra) {
+			m_data.set(i, 0);
+		}
+
+		var wordIndex = 0;
+		var currentWord:Int32 = 0;
+		var bitsInCurrentWord = 0;
+
+		var charIndex = index - 1;
+		while (charIndex >= 0) {
+			var c:Int = value.charCodeAt(charIndex);
+			var digit:Int;
+
+			if ((48 <= c) && (c <= 57)) { // '0'-'9'
+				digit = c - 48;
+			} else if ((65 <= c) && (c <= 70)) { // 'A'-'F'
+				digit = c - 55;
+			} else if ((97 <= c) && (c <= 102)) { // 'a'-'f'
+				digit = c - 87;
+			} else if (c == 32) { // space - skip
+				charIndex--;
 				continue;
 			} else {
 				throw new BigIntException(BigIntError.INVALID_ARGUMENT);
 			}
-			if (bit >= 32) {
-				m_data.set(++pos, 0);
-				bit = 0;
+
+			currentWord |= (digit << bitsInCurrentWord);
+			bitsInCurrentWord += 4;
+
+			if (bitsInCurrentWord >= 32) {
+				m_data.set(wordIndex++, currentWord);
+				currentWord = 0;
+				bitsInCurrentWord = 0;
+			}
+
+			charIndex--;
+		}
+
+		if (bitsInCurrentWord > 0) {
+			if (signed) {
+				var topBit = bitsInCurrentWord - 1;
+				if ((currentWord & (1 << topBit)) != 0) {
+					// Negative number - extend sign bits
+					var mask:Int32 = ~((1 << bitsInCurrentWord) - 1);
+					currentWord |= mask;
+				}
 			}
-			m_data.set(pos, m_data.get(pos) | (c << bit));
-			bit += 4;
-		}
-		// Sign extend
-		m_count = pos + 1;
-		if (signed) {
-			c = ((c & 8) != 0) ? 15 : 0;
-			while (bit < 32) {
-				m_data.set(pos, m_data.get(pos) | (c << bit));
-				bit += 4;
+			m_data.set(wordIndex++, currentWord);
+		}
+
+		m_count = wordIndex;
+
+		// For unsigned,do not interpret as negative
+		if (!signed && m_count > 0) {
+			var topWord = m_data.get(m_count - 1);
+			if (topWord < 0) {
+				m_data.set(m_count++, 0);
 			}
-		} else if (m_data.get(pos) < 0) {
-			m_data.set(m_count++, 0);
 		}
+
 		compact();
 	}
 

+ 5 - 0
std/php/Global.hx

@@ -2183,4 +2183,9 @@ extern class Global {
 		@see http://php.net/manual/en/function.posix-setuid.php
 	**/
 	static function posix_setuid(user_id: Int): Bool;
+	
+	/**
+		@see https://www.php.net/manual/en/function.date-sun-info.php
+	**/
+	public static function date_sun_info(timestamp:Int, latitude:Float, longitude:Float) :NativeArray;
 }

+ 0 - 1
tests/Brewfile

@@ -1,4 +1,3 @@
-brew "opam"
 brew "ninja"
 brew "cmake"
 brew "pkg-config"

+ 3 - 0
tests/misc/projects/Issue12305/compile.hxml

@@ -0,0 +1,3 @@
+-cp src
+-main Main
+--remap foo:haxe

+ 5 - 0
tests/misc/projects/Issue12305/src/Main.hx

@@ -0,0 +1,5 @@
+import foo.display.Position.Range;
+
+function main() {
+	var loc:Null<Range> = null;
+}

+ 39 - 0
tests/misc/projects/Issue12305/src/foo/display/Position.hx

@@ -0,0 +1,39 @@
+package foo.display;
+
+/**
+	Position in a text document expressed as 1-based line and character offset.
+**/
+typedef Position = {
+	/**
+		Line position in a document (1-based).
+	**/
+	var line:Int;
+
+	/**
+		Character offset on a line in a document (1-based).
+	**/
+	var character:Int;
+}
+
+/**
+	A range in a text document expressed as (1-based) start and end positions.
+**/
+typedef Range = {
+	/**
+		The range's start position
+	**/
+	var start:Position;
+
+	/**
+		The range's end position
+	**/
+	var end:Position;
+}
+
+/**
+	Represents a location inside a resource, such as a line inside a text file.
+**/
+typedef Location = {
+	var file:FsPath;
+	var range:Range;
+}

+ 2 - 0
tests/runci/targets/Cpp.hx

@@ -53,6 +53,8 @@ class Cpp {
 				'HXCPP_M32';
 			case 'Linux' if(Linux.arch == Arm64):
 				'HXCPP_LINUX_ARM64';
+			case 'Mac' if(commandResult('arch', []).stdout == "arm64"):
+				'HXCPP_ARM64';
 			case _:
 				'HXCPP_M64';
 		}

+ 13 - 8
tests/runci/targets/Lua.hx

@@ -11,27 +11,32 @@ class Lua {
 	static public function getLuaDependencies(){
 		switch (systemName){
 			case "Linux":
-				Linux.requireAptPackages(["libpcre2-dev", "libssl-dev", "libreadline-dev"]);
-				runCommand("pip", ["install", "--user", "hererocks"]);
-				final pyUserBase = commandResult("python", ["-m", "site", "--user-base"]).stdout.trim();
-				addToPATH(Path.join([pyUserBase, "bin"]));
+				Linux.requireAptPackages(["libpcre2-dev", "libssl-dev", "libreadline-dev", "pipx"]);
+				runCommand("pipx", ["ensurepath"]);
+				runCommand("pipx", ["install", "hererocks"]);
 			case "Mac": {
 				if (commandSucceed("python3", ["-V"]))
 					infoMsg('python3 has already been installed.');
 				else
 					runNetworkCommand("brew", ["install", "python3"]);
 
-				runCommand("pip3", ["install", "hererocks"]);
+				attemptCommand("brew", ["install", "pcre2"]);
 				runCommand("brew", ["install", "openssl"]);
+				runCommand("brew", ["install", "pipx"]);
+				runCommand("pipx", ["ensurepath"]);
+				runCommand("pipx", ["install", "hererocks"]);
 			}
 		}
 	}
 
 	static function installLib(lib : String, version : String, ?server :String){
 		if (!commandSucceed("luarocks", ["show", lib, version])) {
-            final args = ["install", lib, version];
+			final args = ["install", lib, version];
 			if (systemName == "Mac") {
-				args.push('OPENSSL_DIR=/usr/local/opt/openssl@3');
+				final opensslPath = commandResult("brew", ["--prefix", "openssl"]);
+				args.push('OPENSSL_DIR=${opensslPath.stdout.trim()}');
+				final pcrePath = commandResult("brew", ["--prefix", "pcre2"]);
+				args.push('PCRE2_DIR=${pcrePath.stdout.trim()}');
 			}
             if (server != null){
                 final server_arg = '--server=$server';
@@ -86,7 +91,7 @@ class Lua {
 				installLib("luautf8", "0.1.1-1");
 			}
 
-			installLib("hx-lua-simdjson", "0.0.1-1");
+			installLib("https://raw.githubusercontent.com/HaxeFoundation/hx-lua-simdjson/master/hx-lua-simdjson-scm-1.rockspec", "");
 
 			changeDirectory(unitDir);
 			final luaDefine = if (lv.startsWith("-l")) {

+ 123 - 123
tests/unit/src/unit/TestBigInt.hx

@@ -160,10 +160,10 @@ class TestBigInt extends Test {
 		checkCompareInt(0, 2147483647, 2147483647);
 
 		// equality, multi-word
-		checkCompare(0, BigInt.fromHex("12345678 9abcdef0"), BigInt.fromHex("12345678 9abcdef0"));
-		checkCompare(0, BigInt.fromHex("f2345678 9abcdef0"), BigInt.fromHex("f2345678 9abcdef0"));
-		checkCompare(0, BigInt.fromHex("12345678 9abcdef0 12345678"), BigInt.fromHex("12345678 9abcdef0 12345678"));
-		checkCompare(0, BigInt.fromHex("f2345678 9abcdef0 12345678"), BigInt.fromHex("f2345678 9abcdef0 12345678"));
+		checkCompare(0, BigInt.fromHexSigned("12345678 9abcdef0"), BigInt.fromHexSigned("12345678 9abcdef0"));
+		checkCompare(0, BigInt.fromHexSigned("f2345678 9abcdef0"), BigInt.fromHexSigned("f2345678 9abcdef0"));
+		checkCompare(0, BigInt.fromHexSigned("12345678 9abcdef0 12345678"), BigInt.fromHexSigned("12345678 9abcdef0 12345678"));
+		checkCompare(0, BigInt.fromHexSigned("f2345678 9abcdef0 12345678"), BigInt.fromHexSigned("f2345678 9abcdef0 12345678"));
 
 		// less than, single-word
 		checkCompareInt(-1, 0, 1);
@@ -179,17 +179,17 @@ class TestBigInt extends Test {
 		checkCompareInt(-1, -1, 2147483647);
 
 		// less than, multi-word, same length
-		checkCompare(-1, BigInt.fromHex("12345678 9abcdeef"), BigInt.fromHex("12345678 9abcdef0"));
-		checkCompare(-1, BigInt.fromHex("12345677 9abcdef0"), BigInt.fromHex("12345678 9abcdef0"));
-		checkCompare(-1, BigInt.fromHex("f2345678 9abcdef0"), BigInt.fromHex("12345678 9abcdef0"));
-		checkCompare(-1, BigInt.fromHex("f2345678 9abcdeef"), BigInt.fromHex("f2345678 9abcdef0"));
-		checkCompare(-1, BigInt.fromHex("f2345677 9abcdef0"), BigInt.fromHex("f2345678 9abcdef0"));
+		checkCompare(-1, BigInt.fromHexSigned("12345678 9abcdeef"), BigInt.fromHexSigned("12345678 9abcdef0"));
+		checkCompare(-1, BigInt.fromHexSigned("12345677 9abcdef0"), BigInt.fromHexSigned("12345678 9abcdef0"));
+		checkCompare(-1, BigInt.fromHexSigned("f2345678 9abcdef0"), BigInt.fromHexSigned("12345678 9abcdef0"));
+		checkCompare(-1, BigInt.fromHexSigned("f2345678 9abcdeef"), BigInt.fromHexSigned("f2345678 9abcdef0"));
+		checkCompare(-1, BigInt.fromHexSigned("f2345677 9abcdef0"), BigInt.fromHexSigned("f2345678 9abcdef0"));
 
 		// less than, multi-word, different length
-		checkCompare(-1, BigInt.fromHex("12345678 9abcdef0"), BigInt.fromHex("00000001 12345678 9abcdef0"));
-		checkCompare(-1, BigInt.fromHex("f2345678 9abcdef0"), BigInt.fromHex("00000001 12345678 9abcdef0"));
-		checkCompare(-1, BigInt.fromHex("fffffffe 12345678 9abcdef0"), BigInt.fromHex("12345678 9abcdef0"));
-		checkCompare(-1, BigInt.fromHex("fffffffe 12345678 9abcdef0"), BigInt.fromHex("f2345678 9abcdef0"));
+		checkCompare(-1, BigInt.fromHexSigned("12345678 9abcdef0"), BigInt.fromHexSigned("00000001 12345678 9abcdef0"));
+		checkCompare(-1, BigInt.fromHexSigned("f2345678 9abcdef0"), BigInt.fromHexSigned("00000001 12345678 9abcdef0"));
+		checkCompare(-1, BigInt.fromHexSigned("fffffffe 12345678 9abcdef0"), BigInt.fromHexSigned("12345678 9abcdef0"));
+		checkCompare(-1, BigInt.fromHexSigned("fffffffe 12345678 9abcdef0"), BigInt.fromHexSigned("f2345678 9abcdef0"));
 
 		// greater than, single-word
 		checkCompareInt(1, 1, 0);
@@ -200,19 +200,19 @@ class TestBigInt extends Test {
 		checkCompareInt(1, -2147483647, -2147483648);
 
 		// greater than, multi-word, same length
-		checkCompare(1, BigInt.fromHex("12345678 9abcdef1"), BigInt.fromHex("12345678 9abcdef0"));
-		checkCompare(1, BigInt.fromHex("12345679 9abcdef0"), BigInt.fromHex("12345678 9abcdef0"));
-		checkCompare(1, BigInt.fromHex("12345678 9abcdef0"), BigInt.fromHex("f2345678 9abcdef0"));
-		checkCompare(1, BigInt.fromHex("f2345678 9abcdef1"), BigInt.fromHex("f2345678 9abcdef0"));
-		checkCompare(1, BigInt.fromHex("f2345679 9abcdef0"), BigInt.fromHex("f2345678 9abcdef0"));
+		checkCompare(1, BigInt.fromHexSigned("12345678 9abcdef1"), BigInt.fromHexSigned("12345678 9abcdef0"));
+		checkCompare(1, BigInt.fromHexSigned("12345679 9abcdef0"), BigInt.fromHexSigned("12345678 9abcdef0"));
+		checkCompare(1, BigInt.fromHexSigned("12345678 9abcdef0"), BigInt.fromHexSigned("f2345678 9abcdef0"));
+		checkCompare(1, BigInt.fromHexSigned("f2345678 9abcdef1"), BigInt.fromHexSigned("f2345678 9abcdef0"));
+		checkCompare(1, BigInt.fromHexSigned("f2345679 9abcdef0"), BigInt.fromHexSigned("f2345678 9abcdef0"));
 
 		// greater than, multi-word, different length
-		checkCompare(1, BigInt.fromHex("00000001 12345678 9abcdef0"), BigInt.fromHex("12345678 9abcdef0"));
-		checkCompare(1, BigInt.fromHex("00000001 12345678 9abcdef0"), BigInt.fromHex("f2345678 9abcdef0"));
-		checkCompare(1, BigInt.fromHex("12345678 9abcdef0"), BigInt.fromHex("fffffffe 12345678 9abcdef0"));
-		checkCompare(1, BigInt.fromHex("f2345678 9abcdef0"), BigInt.fromHex("fffffffe 12345678 9abcdef0"));
+		checkCompare(1, BigInt.fromHexSigned("00000001 12345678 9abcdef0"), BigInt.fromHexSigned("12345678 9abcdef0"));
+		checkCompare(1, BigInt.fromHexSigned("00000001 12345678 9abcdef0"), BigInt.fromHexSigned("f2345678 9abcdef0"));
+		checkCompare(1, BigInt.fromHexSigned("12345678 9abcdef0"), BigInt.fromHexSigned("fffffffe 12345678 9abcdef0"));
+		checkCompare(1, BigInt.fromHexSigned("f2345678 9abcdef0"), BigInt.fromHexSigned("fffffffe 12345678 9abcdef0"));
 
-		checkCompare(1, BigInt.fromHex("00000001 ffffffff"), BigInt.fromHex("00000001 00000000"));
+		checkCompare(1, BigInt.fromHexSigned("00000001 ffffffff"), BigInt.fromHexSigned("00000001 00000000"));
 	}
 
 	private function checkCompareInt(expected:Int, a:Int, b:Int):Void {
@@ -284,7 +284,7 @@ class TestBigInt extends Test {
 		checkCompareSingle(expected, a, b);
 		checkCompareSingle(-expected, -a, -b);
 		if ((expected != 0) && (a.sign() == b.sign())) {
-			var s:Int = (a.sign() << 1) + 1;
+			var s:Int = a.sign();
 			checkCompareSingle(-s, -a, b);
 			checkCompareSingle(s, a, -b);
 		}
@@ -447,7 +447,7 @@ class TestBigInt extends Test {
 
 		// check quotient overlaps with dividend, special case 3
 		quotient = 11;
-		BigIntArithmetic.divide(quotient, BigInt.fromHex("1 00000000"), quotient, remainder);
+		BigIntArithmetic.divide(quotient, BigInt.fromHexSigned("1 00000000"), quotient, remainder);
 		eq("0", quotient.toString());
 		eq("11", remainder.toString());
 
@@ -476,7 +476,7 @@ class TestBigInt extends Test {
 		eq("0", remainder.toString());
 
 		// check quotient overlaps with divisor, special case 3
-		quotient = BigInt.fromHex("1 00000000");
+		quotient = BigInt.fromHexSigned("1 00000000");
 		BigIntArithmetic.divide(BigInt.fromInt(11), quotient, quotient, remainder);
 		eq("0", quotient.toString());
 		eq("11", remainder.toString());
@@ -507,7 +507,7 @@ class TestBigInt extends Test {
 
 		// check remainder overlaps with dividend, special case 3
 		remainder = 11;
-		BigIntArithmetic.divide(remainder, BigInt.fromHex("1 00000000"), quotient, remainder);
+		BigIntArithmetic.divide(remainder, BigInt.fromHexSigned("1 00000000"), quotient, remainder);
 		eq("0", quotient.toString());
 		eq("11", remainder.toString());
 
@@ -536,7 +536,7 @@ class TestBigInt extends Test {
 		eq("0", remainder.toString());
 
 		// check remainder overlaps with divisor, special case 3
-		remainder = BigInt.fromHex("1 00000000");
+		remainder = BigInt.fromHexSigned("1 00000000");
 		BigIntArithmetic.divide(BigInt.fromInt(11), remainder, quotient, remainder);
 		eq("0", quotient.toString());
 		eq("11", remainder.toString());
@@ -608,11 +608,11 @@ class TestBigInt extends Test {
 		checkLinearEqInt(BigInt.fromInt(5), 3, BigInt.fromInt(1), 2);
 		checkLinearEqInt(BigInt.fromInt(6), 3, BigInt.fromInt(2), 0);
 		checkLinearEqInt(BigInt.fromInt(6), 2, BigInt.fromInt(3), 0);
-		checkLinearEqInt(BigInt.fromHex("12A05F2001"), 81, BigInt.fromInt(987654321), 0);
+		checkLinearEqInt(BigInt.fromHexSigned("12A05F2001"), 81, BigInt.fromInt(987654321), 0);
 
-		checkLinearEq(BigInt.fromHex("0 fffffffe 00000001"), BigInt.fromHex("0 ffffffff"), BigInt.fromHex("0 ffffffff"),
+		checkLinearEq(BigInt.fromHexSigned("0 fffffffe 00000001"), BigInt.fromHexSigned("0 ffffffff"), BigInt.fromHexSigned("0 ffffffff"),
 			BigInt.fromInt(0)); // exercises qhat = 65536
-		checkLinearEq(BigInt.fromHex("00003fff c0000000 7fff8000 00000000"), BigInt.fromHex("7fff8000 00000000"), BigInt.fromHex("00008000 00000001"),
+		checkLinearEq(BigInt.fromHexSigned("00003fff c0000000 7fff8000 00000000"), BigInt.fromHexSigned("7fff8000 00000000"), BigInt.fromHexSigned("00008000 00000001"),
 			BigInt.fromInt(0));
 
 		checkLinearEqInt(BigInt.fromInt(2147483647), 1, BigInt.fromInt(2147483647), 0);
@@ -628,59 +628,59 @@ class TestBigInt extends Test {
 
 		checkLinearEqInt(BigInt.fromInt(2147483647), 2147483647, BigInt.fromInt(1), 0); // exercises use of uninitialized quotient data
 
-		checkLinearEqInt(BigInt.fromHex("100000000"), 1, BigInt.fromHex("100000000"), 0);
-		checkLinearEqInt(BigInt.fromHex("100000000"), 10, BigInt.fromInt(429496729), 6);
-		checkLinearEqInt(BigInt.fromHex("100000000"), 100, BigInt.fromInt(42949672), 96);
-		checkLinearEqInt(BigInt.fromHex("100000000"), 1000, BigInt.fromInt(4294967), 296);
-		checkLinearEqInt(BigInt.fromHex("100000000"), 10000, BigInt.fromInt(429496), 7296);
-		checkLinearEqInt(BigInt.fromHex("100000000"), 100000, BigInt.fromInt(42949), 67296); // exercises rhat >= 65536
-		checkLinearEqInt(BigInt.fromHex("100000000"), 1000000, BigInt.fromInt(4294), 967296);
-		checkLinearEqInt(BigInt.fromHex("100000000"), 10000000, BigInt.fromInt(429), 4967296);
-		checkLinearEqInt(BigInt.fromHex("100000000"), 100000000, BigInt.fromInt(42), 94967296);
-		checkLinearEqInt(BigInt.fromHex("100000000"), 1000000000, BigInt.fromInt(4), 294967296);
-		checkLinearEq(BigInt.fromHex("100000000"), BigInt.fromHex("2540BE400"), BigInt.fromInt(0), BigInt.fromHex("100000000"));
-
-		checkLinearEqInt(BigInt.fromHex("08000"), 1, BigInt.fromHex("08000"), 0);
-		checkLinearEqInt(BigInt.fromHex("080000000"), 1, BigInt.fromHex("080000000"), 0);
-		checkLinearEqInt(BigInt.fromHex("0800000000000"), 1, BigInt.fromHex("0800000000000"), 0);
-		checkLinearEqInt(BigInt.fromHex("08000000000000000"), 1, BigInt.fromHex("08000000000000000"), 0);
-		checkLinearEqInt(BigInt.fromHex("10001"), 2, BigInt.fromHex("08000"), 1);
-		checkLinearEqInt(BigInt.fromHex("100000001"), 2, BigInt.fromHex("080000000"), 1);
-		checkLinearEqInt(BigInt.fromHex("1000000000001"), 2, BigInt.fromHex("0800000000000"), 1);
-		checkLinearEqInt(BigInt.fromHex("10000000000000001"), 2, BigInt.fromHex("08000000000000000"), 1);
-
-		checkLinearEqInt(BigInt.fromHex("0ffffffff"), 1, BigInt.fromHex("0ffffffff"), 0);
-		checkLinearEqInt(BigInt.fromHex("0ffffffffffffffff"), 1, BigInt.fromHex("0ffffffffffffffff"), 0);
-		checkLinearEqInt(BigInt.fromHex("0ffffffffffffffffffffffff"), 1, BigInt.fromHex("0ffffffffffffffffffffffff"), 0);
-		checkLinearEqInt(BigInt.fromHex("0ffffffff"), 2, BigInt.fromHex("07fffffff"), 1);
-		checkLinearEqInt(BigInt.fromHex("0ffffffffffffffff"), 2, BigInt.fromHex("07fffffffffffffff"), 1);
-		checkLinearEqInt(BigInt.fromHex("0ffffffffffffffffffffffff"), 2, BigInt.fromHex("07fffffffffffffffffffffff"), 1);
+		checkLinearEqInt(BigInt.fromHexSigned("100000000"), 1, BigInt.fromHexSigned("100000000"), 0);
+		checkLinearEqInt(BigInt.fromHexSigned("100000000"), 10, BigInt.fromInt(429496729), 6);
+		checkLinearEqInt(BigInt.fromHexSigned("100000000"), 100, BigInt.fromInt(42949672), 96);
+		checkLinearEqInt(BigInt.fromHexSigned("100000000"), 1000, BigInt.fromInt(4294967), 296);
+		checkLinearEqInt(BigInt.fromHexSigned("100000000"), 10000, BigInt.fromInt(429496), 7296);
+		checkLinearEqInt(BigInt.fromHexSigned("100000000"), 100000, BigInt.fromInt(42949), 67296); // exercises rhat >= 65536
+		checkLinearEqInt(BigInt.fromHexSigned("100000000"), 1000000, BigInt.fromInt(4294), 967296);
+		checkLinearEqInt(BigInt.fromHexSigned("100000000"), 10000000, BigInt.fromInt(429), 4967296);
+		checkLinearEqInt(BigInt.fromHexSigned("100000000"), 100000000, BigInt.fromInt(42), 94967296);
+		checkLinearEqInt(BigInt.fromHexSigned("100000000"), 1000000000, BigInt.fromInt(4), 294967296);
+		checkLinearEq(BigInt.fromHexSigned("100000000"), BigInt.fromHexSigned("2540BE400"), BigInt.fromInt(0), BigInt.fromHexSigned("100000000"));
+
+		checkLinearEqInt(BigInt.fromHexSigned("08000"), 1, BigInt.fromHexSigned("08000"), 0);
+		checkLinearEqInt(BigInt.fromHexSigned("080000000"), 1, BigInt.fromHexSigned("080000000"), 0);
+		checkLinearEqInt(BigInt.fromHexSigned("0800000000000"), 1, BigInt.fromHexSigned("0800000000000"), 0);
+		checkLinearEqInt(BigInt.fromHexSigned("08000000000000000"), 1, BigInt.fromHexSigned("08000000000000000"), 0);
+		checkLinearEqInt(BigInt.fromHexSigned("10001"), 2, BigInt.fromHexSigned("08000"), 1);
+		checkLinearEqInt(BigInt.fromHexSigned("100000001"), 2, BigInt.fromHexSigned("080000000"), 1);
+		checkLinearEqInt(BigInt.fromHexSigned("1000000000001"), 2, BigInt.fromHexSigned("0800000000000"), 1);
+		checkLinearEqInt(BigInt.fromHexSigned("10000000000000001"), 2, BigInt.fromHexSigned("08000000000000000"), 1);
+
+		checkLinearEqInt(BigInt.fromHexSigned("0ffffffff"), 1, BigInt.fromHexSigned("0ffffffff"), 0);
+		checkLinearEqInt(BigInt.fromHexSigned("0ffffffffffffffff"), 1, BigInt.fromHexSigned("0ffffffffffffffff"), 0);
+		checkLinearEqInt(BigInt.fromHexSigned("0ffffffffffffffffffffffff"), 1, BigInt.fromHexSigned("0ffffffffffffffffffffffff"), 0);
+		checkLinearEqInt(BigInt.fromHexSigned("0ffffffff"), 2, BigInt.fromHexSigned("07fffffff"), 1);
+		checkLinearEqInt(BigInt.fromHexSigned("0ffffffffffffffff"), 2, BigInt.fromHexSigned("07fffffffffffffff"), 1);
+		checkLinearEqInt(BigInt.fromHexSigned("0ffffffffffffffffffffffff"), 2, BigInt.fromHexSigned("07fffffffffffffffffffffff"), 1);
 
 		// exercise quotient with high bit set when length of divisor == length of dividend and divisor >= 65536
-		checkLinearEq(BigInt.fromHex("4000000000000000"), BigInt.fromHex("080000000"), BigInt.fromHex("080000000"),
+		checkLinearEq(BigInt.fromHexSigned("4000000000000000"), BigInt.fromHexSigned("080000000"), BigInt.fromHexSigned("080000000"),
 			BigInt.fromInt(0)); // exercises uninitialized work data
-		checkLinearEq(BigInt.fromHex("4000000080000000"), BigInt.fromHex("080000001"), BigInt.fromHex("080000000"), BigInt.fromInt(0));
-		checkLinearEq(BigInt.fromHex("4000000100000000"), BigInt.fromHex("080000001"), BigInt.fromHex("080000000"), BigInt.fromHex("080000000"));
-		checkLinearEq(BigInt.fromHex("40000000ffffffff"), BigInt.fromHex("080000001"), BigInt.fromHex("080000000"), BigInt.fromHex("7fffffff"));
-		checkLinearEq(BigInt.fromHex("4000000100000001"), BigInt.fromHex("080000001"), BigInt.fromHex("080000001"), BigInt.fromInt(0));
+		checkLinearEq(BigInt.fromHexSigned("4000000080000000"), BigInt.fromHexSigned("080000001"), BigInt.fromHexSigned("080000000"), BigInt.fromInt(0));
+		checkLinearEq(BigInt.fromHexSigned("4000000100000000"), BigInt.fromHexSigned("080000001"), BigInt.fromHexSigned("080000000"), BigInt.fromHexSigned("080000000"));
+		checkLinearEq(BigInt.fromHexSigned("40000000ffffffff"), BigInt.fromHexSigned("080000001"), BigInt.fromHexSigned("080000000"), BigInt.fromHexSigned("7fffffff"));
+		checkLinearEq(BigInt.fromHexSigned("4000000100000001"), BigInt.fromHexSigned("080000001"), BigInt.fromHexSigned("080000001"), BigInt.fromInt(0));
 
-		checkLinearEq(BigInt.fromHex("08000"), BigInt.fromHex("0800000001"), BigInt.fromHex("0"), BigInt.fromHex("08000"));
+		checkLinearEq(BigInt.fromHexSigned("08000"), BigInt.fromHexSigned("0800000001"), BigInt.fromHexSigned("0"), BigInt.fromHexSigned("08000"));
 		// these exercise the qhat reduction path
-		checkLinearEq(BigInt.fromHex("080000000"), BigInt.fromHex("080000001"), BigInt.fromHex("0"), BigInt.fromHex("080000000"));
-		checkLinearEq(BigInt.fromHex("0800080010000"), BigInt.fromHex("080000001"), BigInt.fromHex("10000"), BigInt.fromHex("080000000"));
-		checkLinearEq(BigInt.fromHex("0800100010001"), BigInt.fromHex("080000001"), BigInt.fromHex("10001"), BigInt.fromHex("080000000"));
-		checkLinearEq(BigInt.fromHex("08000000180000000"), BigInt.fromHex("080000001"), BigInt.fromHex("100000000"), BigInt.fromHex("080000000"));
-		checkLinearEq(BigInt.fromHex("08000000200000001"), BigInt.fromHex("080000001"), BigInt.fromHex("100000001"), BigInt.fromHex("080000000"));
+		checkLinearEq(BigInt.fromHexSigned("080000000"), BigInt.fromHexSigned("080000001"), BigInt.fromHexSigned("0"), BigInt.fromHexSigned("080000000"));
+		checkLinearEq(BigInt.fromHexSigned("0800080010000"), BigInt.fromHexSigned("080000001"), BigInt.fromHexSigned("10000"), BigInt.fromHexSigned("080000000"));
+		checkLinearEq(BigInt.fromHexSigned("0800100010001"), BigInt.fromHexSigned("080000001"), BigInt.fromHexSigned("10001"), BigInt.fromHexSigned("080000000"));
+		checkLinearEq(BigInt.fromHexSigned("08000000180000000"), BigInt.fromHexSigned("080000001"), BigInt.fromHexSigned("100000000"), BigInt.fromHexSigned("080000000"));
+		checkLinearEq(BigInt.fromHexSigned("08000000200000001"), BigInt.fromHexSigned("080000001"), BigInt.fromHexSigned("100000001"), BigInt.fromHexSigned("080000000"));
 
 		// this exercises long division with a quotient with high bit set
-		checkLinearEq(BigInt.fromHex("08000000180000000"), BigInt.fromHex("100000000"), BigInt.fromHex("080000001"), BigInt.fromHex("080000000"));
+		checkLinearEq(BigInt.fromHexSigned("08000000180000000"), BigInt.fromHexSigned("100000000"), BigInt.fromHexSigned("080000001"), BigInt.fromHexSigned("080000000"));
 
 		// these exercise the "add back" path
-		checkLinearEq(BigInt.fromHex("7fff800000000000"), BigInt.fromHex("0800000000001"), BigInt.fromHex("0fffe"), BigInt.fromHex("7fffffff0002"));
-		checkLinearEq(BigInt.fromHex("7fffffff800000010000000000000000"), BigInt.fromHex("0800000008000000200000005"), BigInt.fromHex("0fffffffd"),
-			BigInt.fromHex("080000000800000010000000f"));
+		checkLinearEq(BigInt.fromHexSigned("7fff800000000000"), BigInt.fromHexSigned("0800000000001"), BigInt.fromHexSigned("0fffe"), BigInt.fromHexSigned("7fffffff0002"));
+		checkLinearEq(BigInt.fromHexSigned("7fffffff800000010000000000000000"), BigInt.fromHexSigned("0800000008000000200000005"), BigInt.fromHexSigned("0fffffffd"),
+			BigInt.fromHexSigned("080000000800000010000000f"));
 
-		checkLinearEq(BigInt.fromInt(1), BigInt.fromHex("100000000"), BigInt.fromInt(0), BigInt.fromInt(1));
+		checkLinearEq(BigInt.fromInt(1), BigInt.fromHexSigned("100000000"), BigInt.fromInt(0), BigInt.fromInt(1));
 	}
 
 	private function checkLinearEqInt(y:BigInt, a:Int, x:BigInt, b:Int):Void {
@@ -826,10 +826,10 @@ class TestBigInt extends Test {
 		checkEquality(BigInt.fromInt(1), BigInt.fromInt(1), true);
 		checkEquality(BigInt.fromInt(0x12345678), BigInt.fromInt(0x12345678), true);
 		checkEquality(BigInt.fromInt(0x12345678), BigInt.fromInt(0x12345670), false);
-		checkEquality(BigInt.fromHex("1234567800000000"), BigInt.fromInt(0), false);
-		checkEquality(BigInt.fromHex("1234567800000000"), BigInt.fromHex("1234567800000000"), true);
-		checkEquality(BigInt.fromHex("1234567800000000"), BigInt.fromHex("11234567800000000"), false);
-		checkEquality(BigInt.fromHex("1234567800000000"), BigInt.fromHex("123456780000000"), false);
+		checkEquality(BigInt.fromHexSigned("1234567800000000"), BigInt.fromInt(0), false);
+		checkEquality(BigInt.fromHexSigned("1234567800000000"), BigInt.fromHexSigned("1234567800000000"), true);
+		checkEquality(BigInt.fromHexSigned("1234567800000000"), BigInt.fromHexSigned("11234567800000000"), false);
+		checkEquality(BigInt.fromHexSigned("1234567800000000"), BigInt.fromHexSigned("123456780000000"), false);
 	}
 
 	private function checkEquality(a:BigInt, b:BigInt, expected:Bool):Void {
@@ -857,23 +857,23 @@ class TestBigInt extends Test {
 		checkAddInt(BigInt.fromInt(-1), 2, BigInt.fromInt(1));
 		checkAddInt(BigInt.fromInt(-1), -1, BigInt.fromInt(-2));
 
-		checkAddInt(BigInt.fromHex("000000000000000007fffffff"), 1, BigInt.fromHex("0000000000000000080000000"));
-		checkAddInt(BigInt.fromHex("0000000007fffffffffffffff"), 1, BigInt.fromHex("0000000008000000000000000"));
-		checkAddInt(BigInt.fromHex("07fffffffffffffffffffffff"), 1, BigInt.fromHex("0800000000000000000000000"));
-		checkAddInt(BigInt.fromHex("0ffffffffffffffffffffffff"), 1, BigInt.fromHex("1000000000000000000000000"));
-		checkAddInt(BigInt.fromHex("0fffffffffffffffeffffffff"), 1, BigInt.fromHex("0ffffffffffffffff00000000"));
+		checkAddInt(BigInt.fromHexSigned("000000000000000007fffffff"), 1, BigInt.fromHexSigned("0000000000000000080000000"));
+		checkAddInt(BigInt.fromHexSigned("0000000007fffffffffffffff"), 1, BigInt.fromHexSigned("0000000008000000000000000"));
+		checkAddInt(BigInt.fromHexSigned("07fffffffffffffffffffffff"), 1, BigInt.fromHexSigned("0800000000000000000000000"));
+		checkAddInt(BigInt.fromHexSigned("0ffffffffffffffffffffffff"), 1, BigInt.fromHexSigned("1000000000000000000000000"));
+		checkAddInt(BigInt.fromHexSigned("0fffffffffffffffeffffffff"), 1, BigInt.fromHexSigned("0ffffffffffffffff00000000"));
 
-		checkAdd(BigInt.fromHex("0ffffffffffffffff00000000"), BigInt.fromHex("100000000"), BigInt.fromHex("1000000000000000000000000"));
-		checkAdd(BigInt.fromHex("0ffffffff0000000000000000"), BigInt.fromHex("10000000000000000"), BigInt.fromHex("1000000000000000000000000"));
+		checkAdd(BigInt.fromHexSigned("0ffffffffffffffff00000000"), BigInt.fromHexSigned("100000000"), BigInt.fromHexSigned("1000000000000000000000000"));
+		checkAdd(BigInt.fromHexSigned("0ffffffff0000000000000000"), BigInt.fromHexSigned("10000000000000000"), BigInt.fromHexSigned("1000000000000000000000000"));
 
-		checkAdd(BigInt.fromHex("12345678"), BigInt.fromHex("11111111"), BigInt.fromHex("23456789"));
-		checkAdd(BigInt.fromHex("1234567812345678"), BigInt.fromHex("1111111111111111"), BigInt.fromHex("2345678923456789"));
-		checkAdd(BigInt.fromHex("123456781234567812345678"), BigInt.fromHex("111111111111111111111111"), BigInt.fromHex("234567892345678923456789"));
-		checkAdd(BigInt.fromHex("1234567812345678"), BigInt.fromHex("11111111"), BigInt.fromHex("1234567823456789"));
-		checkAdd(BigInt.fromHex("123456781234567812345678"), BigInt.fromHex("11111111"), BigInt.fromHex("123456781234567823456789"));
-		checkAdd(BigInt.fromHex("1234567812345678"), BigInt.fromHex("1111111100000000"), BigInt.fromHex("2345678912345678"));
-		checkAdd(BigInt.fromHex("123456781234567812345678"), BigInt.fromHex("111111110000000000000000"), BigInt.fromHex("234567891234567812345678"));
-		checkAdd(BigInt.fromHex("123456781234567812345678"), BigInt.fromHex("111111110000000011111111"), BigInt.fromHex("234567891234567823456789"));
+		checkAdd(BigInt.fromHexSigned("12345678"), BigInt.fromHexSigned("11111111"), BigInt.fromHexSigned("23456789"));
+		checkAdd(BigInt.fromHexSigned("1234567812345678"), BigInt.fromHexSigned("1111111111111111"), BigInt.fromHexSigned("2345678923456789"));
+		checkAdd(BigInt.fromHexSigned("123456781234567812345678"), BigInt.fromHexSigned("111111111111111111111111"), BigInt.fromHexSigned("234567892345678923456789"));
+		checkAdd(BigInt.fromHexSigned("1234567812345678"), BigInt.fromHexSigned("11111111"), BigInt.fromHexSigned("1234567823456789"));
+		checkAdd(BigInt.fromHexSigned("123456781234567812345678"), BigInt.fromHexSigned("11111111"), BigInt.fromHexSigned("123456781234567823456789"));
+		checkAdd(BigInt.fromHexSigned("1234567812345678"), BigInt.fromHexSigned("1111111100000000"), BigInt.fromHexSigned("2345678912345678"));
+		checkAdd(BigInt.fromHexSigned("123456781234567812345678"), BigInt.fromHexSigned("111111110000000000000000"), BigInt.fromHexSigned("234567891234567812345678"));
+		checkAdd(BigInt.fromHexSigned("123456781234567812345678"), BigInt.fromHexSigned("111111110000000011111111"), BigInt.fromHexSigned("234567891234567823456789"));
 	}
 
 	private function checkAddInt(a:BigInt, b:Int, expected:BigInt):Void {
@@ -942,11 +942,11 @@ class TestBigInt extends Test {
 		eq("1", (-BigInt.fromInt(-1)).toString());
 		eq(BigInt.fromInt(-100).toString(), (-BigInt.fromInt(100)).toString());
 		eq("100", (-BigInt.fromInt(-100)).toString());
-		eq(BigInt.fromHex("080000000").toHex(), (-BigInt.fromInt(-2147483648)).toHex());
-		eq(BigInt.fromInt(-2147483648).toHex(), (-BigInt.fromHex("080000000")).toHex());
-		eq(BigInt.fromHex("08000000000000000").toHex(), (-BigInt.fromHex("8000000000000000")).toHex());
-		eq(BigInt.fromHex("8000000000000000").toHex(), (-BigInt.fromHex("08000000000000000")).toHex());
-		eq(BigInt.fromHex("edcba98800000000").toHex(), (-BigInt.fromHex("1234567800000000")).toHex());
+		eq(BigInt.fromHexSigned("080000000").toHex(), (-BigInt.fromInt(-2147483648)).toHex());
+		eq(BigInt.fromInt(-2147483648).toHex(), (-BigInt.fromHexSigned("080000000")).toHex());
+		eq(BigInt.fromHexSigned("08000000000000000").toHex(), (-BigInt.fromHexSigned("8000000000000000")).toHex());
+		eq(BigInt.fromHexSigned("8000000000000000").toHex(), (-BigInt.fromHexSigned("08000000000000000")).toHex());
+		eq(BigInt.fromHexSigned("edcba98800000000").toHex(), (-BigInt.fromHexSigned("1234567800000000")).toHex());
 	}
 
 	public function bigIntFromString():Void {
@@ -985,8 +985,8 @@ class TestBigInt extends Test {
 		eq("7fffffff", BigInt.fromString("02147483647").toHex());
 		eq(BigInt.fromInt(-2147483648).toHex(), BigInt.fromString("-2147483648").toHex());
 		eq(BigInt.fromInt(-2147483648).toHex(), BigInt.fromString("-02147483648").toHex());
-		eq(BigInt.fromHex("080000000").toHex(), BigInt.fromString("2147483648").toHex());
-		eq(BigInt.fromHex("f7fffffff").toHex(), BigInt.fromString("-2147483649").toHex());
+		eq(BigInt.fromHexSigned("080000000").toHex(), BigInt.fromString("2147483648").toHex());
+		eq(BigInt.fromHexSigned("f7fffffff").toHex(), BigInt.fromString("-2147483649").toHex());
 
 		var a:MutableBigInt = 1;
 		for (i in 0...96) {
@@ -1010,7 +1010,7 @@ class TestBigInt extends Test {
 		eq(BigInt.fromInt(-100).toHex(), BigInt.fromBytes(Bytes.ofHex("ffffff9c")).toHex());
 		eq("7fffffff", BigInt.fromBytes(Bytes.ofHex("7fffffff")).toHex());
 		eq(BigInt.fromInt(-2147483648).toHex(), BigInt.fromBytes(Bytes.ofHex("80000000")).toHex());
-		eq(BigInt.fromHex("f7fffffff").toHex(), BigInt.fromBytes(Bytes.ofHex("ffffffff7fffffff")).toHex());
+		eq(BigInt.fromHexSigned("f7fffffff").toHex(), BigInt.fromBytes(Bytes.ofHex("ffffffff7fffffff")).toHex());
 	}
 
 	public function bigIntArithmeticShiftLeftAssignDoesntClobber():Void {
@@ -1053,23 +1053,23 @@ class TestBigInt extends Test {
 		}
 
 		asl(BigInt.ONE, 1, BigInt.fromInt(2));
-		asl(BigInt.ONE, 31, BigInt.fromHex("080000000"));
-		asl(BigInt.fromHex("080000000"), 1, BigInt.fromHex("100000000"));
+		asl(BigInt.ONE, 31, BigInt.fromHexSigned("080000000"));
+		asl(BigInt.fromHexSigned("080000000"), 1, BigInt.fromHexSigned("100000000"));
 
 		var sb = new StringBuf();
 		sb.add("1");
 		for (i in 0...100) {
-			asl(BigInt.ONE, i * 4, BigInt.fromHex(sb.toString()));
+			asl(BigInt.ONE, i * 4, BigInt.fromHexSigned(sb.toString()));
 			sb.add("0");
 		}
 		sb = new StringBuf();
 		sb.add("08");
 		for (i in 0...100) {
-			asl(BigInt.ONE, i * 4 + 3, BigInt.fromHex(sb.toString()));
+			asl(BigInt.ONE, i * 4 + 3, BigInt.fromHexSigned(sb.toString()));
 			sb.add("0");
 		}
 
-		asl(BigInt.fromHex("08000000180000000"), 15, BigInt.fromHex("40000000c00000000000"));
+		asl(BigInt.fromHexSigned("08000000180000000"), 15, BigInt.fromHexSigned("40000000c00000000000"));
 	}
 
 	private function asl(a:BigInt, b:Int, expected:BigInt):Void {
@@ -1097,14 +1097,14 @@ class TestBigInt extends Test {
 
 	public function bigIntSign():Void {
 		eq(0, BigInt.ZERO.sign());
-		eq(0, BigInt.ONE.sign());
+		eq(1, BigInt.ONE.sign());
 		eq(-1, BigInt.MINUS_ONE.sign());
-		eq(0, BigInt.fromInt(2147483647).sign());
+		eq(1, BigInt.fromInt(2147483647).sign());
 		eq(-1, BigInt.fromInt(-2147483648).sign());
 	}
 
 	public function bigIntSetFromIntWithLargeLength():Void {
-		var x:MutableBigInt = BigInt.fromHex("1 00000000");
+		var x:MutableBigInt = BigInt.fromHexSigned("1 00000000");
 		x <<= 1; // make it owned
 		var y:MutableBigInt_ = x;
 		y.setFromInt(11);
@@ -1116,22 +1116,22 @@ class TestBigInt extends Test {
 		eq("00000001", BigInt.ONE.toHex());
 		eq("ffffffff", BigInt.MINUS_ONE.toHex());
 
-		eq("0", BigInt.fromHex("0").toString());
-		eq("1", BigInt.fromHex("1").toString());
-		eq(BigInt.fromInt(-1).toHex(), BigInt.fromHex("f").toHex());
+		eq("0", BigInt.fromHexSigned("0").toString());
+		eq("1", BigInt.fromHexSigned("1").toString());
+		eq(BigInt.fromInt(-1).toHex(), BigInt.fromHexSigned("f").toHex());
 
 		try {
-			var x = BigInt.fromHex(null);
+			var x = BigInt.fromHexSigned(null);
 		} catch (e) {
 			eq(e.message, BigIntError.INVALID_ARGUMENT);
 		}
 		try {
-			var x = BigInt.fromHex("");
+			var x = BigInt.fromHexSigned("");
 		} catch (e) {
 			eq(e.message, BigIntError.INVALID_ARGUMENT);
 		}
 		try {
-			var x = BigInt.fromHex("0q0");
+			var x = BigInt.fromHexSigned("0q0");
 		} catch (e) {
 			eq(e.message, BigIntError.INVALID_ARGUMENT);
 		}
@@ -1147,10 +1147,10 @@ class TestBigInt extends Test {
 			checkHexString(sb.toString());
 		}
 
-		eq("2147483647", BigInt.fromHex("07fffffff").toString());
-		eq("-2147483648", BigInt.fromHex("f80000000").toString());
+		eq("2147483647", BigInt.fromHexSigned("07fffffff").toString());
+		eq("-2147483648", BigInt.fromHexSigned("f80000000").toString());
 
-		eq("-2147483648", BigInt.fromHex("8000 0000").toString());
+		eq("-2147483648", BigInt.fromHexSigned("8000 0000").toString());
 
 		eq(BigInt.fromHexSigned("080000000").toHex(), BigInt.fromHexUnsigned("80000000").toHex());
 		eq(BigInt.fromHexSigned("0ffffffff").toHex(), BigInt.fromHexUnsigned("ffffffff").toHex());
@@ -1158,7 +1158,7 @@ class TestBigInt extends Test {
 	}
 
 	private function checkHexString(value:String):Void {
-		var bi = BigInt.fromHex(value);
+		var bi = BigInt.fromHexSigned(value);
 		eq(value.toLowerCase(), bi.toHex().toLowerCase());
 		var by = bi.toBytes();
 		eq(by.toHex().toLowerCase(), bi.toHex().toLowerCase());
@@ -1187,7 +1187,7 @@ class TestBigInt extends Test {
 			s = s + "0";
 			checkDecString(s);
 		}
-		eq("1512366075204170929049582354406559215", BigInt.fromHex("01234567 89abcdef 01234567 89abcdef").toString());
+		eq("1512366075204170929049582354406559215", BigInt.fromHexSigned("01234567 89abcdef 01234567 89abcdef").toString());
 		#end
 	}
 
@@ -1201,7 +1201,7 @@ class TestBigInt extends Test {
 
 	public function testBigIntTools() {
 		// Test makes copy
-		var a:MutableBigInt = BigInt.fromHex("123456789abcdef0");
+		var a:MutableBigInt = BigInt.fromHexSigned("123456789abcdef0");
 		var b = BigIntTools.parseValueUnsigned(a);
 		eq("123456789abcdef0", b.toHex());
 		a.clear();
@@ -1233,9 +1233,9 @@ class TestBigInt extends Test {
 		t(BigIntTools.isBigInt(b1));
 
 		// Test parse
-		eq(BigInt.fromHex("123456789abcdef0").toHex(), BigIntTools.parseValueUnsigned("0x123456789abcdef0").toHex());
+		eq(BigInt.fromHexSigned("123456789abcdef0").toHex(), BigIntTools.parseValueUnsigned("0x123456789abcdef0").toHex());
 		eq(BigInt.fromString("12345678901234567890").toHex(), BigIntTools.parseValueUnsigned("12345678901234567890").toHex());
-		eq(BigInt.fromHex("080000000").toHex(), BigIntTools.parseValueUnsigned("0x80000000").toHex());
+		eq(BigInt.fromHexSigned("080000000").toHex(), BigIntTools.parseValueUnsigned("0x80000000").toHex());
 	}
 
 	public function testMultiwordArithmeticCompare():Void {

+ 1 - 1
tests/unit/src/unit/TestMain.hx

@@ -69,7 +69,7 @@ function main() {
 		#if (!php && !lua)
 		new TestHttps(),
 		#end
-		#if (hl || jvm)
+		#if !lua 
 		new TestBigInt(),
 		#end
 		#if !no_pattern_matching