Skip to content

Support for RISC-V architecture #163

Closed

Description

@hoytech

In this issue hoytech/strfry#260 it was reported that compiling on RISC-V fails with:

#error Target architecture was not detected as supported by Double-Conversion.

Adding || defined(__riscv) to include/tao/json/external/double.hpp appears to fix the issue.

Thanks!

Activity

  1. self-assigned this
    on Sep 1, 2026
  2. braydonf commented on Sep 1, 2026

    @braydonf
    Contributor

    Based on the comment in double.hpp, RISC-V (RVA23) gives the result of Div_double(89255.0, 1e22) as equal to 89255e-22. [1] [2] Thus, adding __riscv alongside __x86_64__ and __aarch64__ should be all that is needed, or perhaps defined(__riscv) && __riscv_xlen == 64 to check for 64 bits?

  3. braydonf commented on Sep 2, 2026

    @braydonf
    Contributor

    With this change, all tests passed running make test from the cmake build:

    diff --git a/include/tao/json/external/double.hpp b/include/tao/json/external/double.hpp
    index 0219c27b..7cff5903 100644
    --- a/include/tao/json/external/double.hpp
    +++ b/include/tao/json/external/double.hpp
    @@ -63,7 +63,8 @@
        defined(__SH4__) || defined(__alpha__) ||                            \
        defined(_MIPS_ARCH_MIPS32R2) ||                                      \
        defined(__AARCH64EL__) || defined(__aarch64__) ||                    \
    -   defined(__EMSCRIPTEN__) || defined(__loongarch64)
    +   defined(__EMSCRIPTEN__) || defined(__loongarch64) ||                 \
    +   (defined(__riscv) && __riscv_xlen == 64)
     #define TAO_JSON_DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
     #elif defined(__mc68000__)
     #undef TAO_JSON_DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS

    PR: #164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions