Pseiderer/add nios2 and xtensa 001 (#119)

* double-conversion: enable for nios2

Nios2 supports double conversion, tested using qemu:

./main || echo "correct"
correct
uname -a
Linux buildroot 4.19.16 #4 Sat Aug 3 14:46:48 CEST 2019 nios2 GNU/Linux

Solves build error

In file included from double-conversion.h:42:0,
                 from number_decimalquantity.cpp:19:
double-conversion-utils.h:119:2: error: #error Target architecture was not detected as supported by Double-Conversion.
 #error Target architecture was not detected as supported by Double-Conversion.

detected by buildroot autobuilders:
http://autobuild.buildroot.net/results/91e/91eaec34708d91f8a05af189243be0b7cabce31b/

Patch sent upstream: https://github.com/unicode-org/icu/pull/725
Bug report: https://unicode-org.atlassian.net/browse/ICU-20751

[Bernd: Fixed path]
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
[Added Changelog entry]
Signed-off-by: Peter Seiderer <ps.report@gmx.net>

* double-conversion: enable for xtensa

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Note:

Double-conversion tested with:

        $ cat div.c
double Div_double(double x, double y) { return x / y; }

        $ cat main.c
double Div_double(double x, double y);

int main(int argc, char** argv) {
  double result = Div_double(89255.0, 1e22);
  if (result == 89255e-22) {
    printf("correct result %e\n", result);
    return 1;
  } else {
    printf("wrong result %e\n", result);
    return 0;
  }
}

Tested for xtensa (using qemu_xtensa_lx60_defconfig plus BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE):

        $ ./host/bin/xtensa-buildroot-linux-uclibc-gcc -c div.c
        $ ./host/bin/xtensa-buildroot-linux-uclibc-gcc -c main.c
        $ ./host/bin/xtensa-buildroot-linux-uclibc-gcc -o main main.o div.o

        $ ./host/bin/qemu-xtensa -L staging main
correct result 8.925500e-18
2 files changed
tree: b93dda600e986654b07c4fc10221206734ba1996
  1. cmake/
  2. double-conversion/
  3. msvc/
  4. test/
  5. .gitignore
  6. AUTHORS
  7. BUILD
  8. Changelog
  9. CMakeLists.txt
  10. COPYING
  11. LICENSE
  12. Makefile
  13. README.md
  14. SConstruct
  15. WORKSPACE
README.md

https://github.com/google/double-conversion

This project (double-conversion) provides binary-decimal and decimal-binary routines for IEEE doubles.

The library consists of efficient conversion routines that have been extracted from the V8 JavaScript engine. The code has been refactored and improved so that it can be used more easily in other projects.

There is extensive documentation in double-conversion/string-to-double.h and double-conversion/double-to-string.h. Other examples can be found in test/cctest/test-conversions.cc.

Building

This library can be built with scons or cmake. The checked-in Makefile simply forwards to scons, and provides a shortcut to run all tests:

make
make test

Scons

The easiest way to install this library is to use scons. It builds the static and shared library, and is set up to install those at the correct locations:

scons install

Use the DESTDIR option to change the target directory:

scons DESTDIR=alternative_directory install

Cmake

To use cmake run cmake . in the root directory. This overwrites the existing Makefile.

Use -DBUILD_SHARED_LIBS=ON to enable the compilation of shared libraries. Note that this disables static libraries. There is currently no way to build both libraries at the same time with cmake.

Use -DBUILD_TESTING=ON to build the test executable.

cmake . -DBUILD_TESTING=ON
make
test/cctest/cctest --list | tr -d '<' | xargs test/cctest/cctest