Skip to content
  • Peter Seiderer's avatar
    Pseiderer/add nios2 and xtensa 001 (#119) · a54561be
    Peter Seiderer authored
    * 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: default avatarBernd Kuhls <[email protected]>
    [Added Changelog entry]
    Signed-off-by: default avatarPeter Seiderer <[email protected]>
    
    * double-conversion: enable for xtensa
    
    Signed-off-by: default avatarPeter Seiderer <[email protected]>
    ---
    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
    a54561be
To find the state of this project's repository at the time of any of these versions, check out the tags.