Giter Site home page Giter Site logo

add support for riscv64 about zycore-c HOT 4 OPEN

yuzibo avatar yuzibo commented on June 10, 2024
add support for riscv64

from zycore-c.

Comments (4)

flobernd avatar flobernd commented on June 10, 2024

Hi there,

thanks for submitting your patch 🙂 We will try to integrate this upstream.

Pasting the patch here for reference:

--- a/include/Zycore/Defines.h
+++ b/include/Zycore/Defines.h
@@ -131,6 +131,8 @@
 #   define ZYAN_AARCH64
 #elif defined(_M_ARM) || defined(_M_ARMT) || defined(__arm__) || defined(__thumb__)
 #   define ZYAN_ARM
+#elif defined(_M_RISCV64) || defined(__riscv) && __riscv_xlen == 64
+#   define ZYAN_RISCV64
 #elif defined(__EMSCRIPTEN__)
     // Nothing to do, `ZYAN_EMSCRIPTEN` is both platform and arch macro for this one.
 #else
--- a/src/Format.c
+++ b/src/Format.c
@@ -423,7 +423,7 @@
 
 ZyanStatus ZyanStringAppendDecU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length)
 {
-#if defined(ZYAN_X64) || defined(ZYAN_AARCH64)
+#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_RISCV64)
     return ZyanStringAppendDecU64(string, value, padding_length);
 #else
     // Working with 64-bit values is slow on non 64-bit systems
@@ -464,7 +464,7 @@
 ZyanStatus ZyanStringAppendHexU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
     ZyanBool uppercase)
 {
-#if defined(ZYAN_X64) || defined(ZYAN_AARCH64)
+#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_RISCV64)
     return ZyanStringAppendHexU64(string, value, padding_length, uppercase);
 #else
     // Working with 64-bit values is slow on non 64-bit systems

from zycore-c.

flobernd avatar flobernd commented on June 10, 2024

@athre0z We should probably as well introduce a generic ZYAN_ARCH64 (open for better name suggestions). Same for 32-bit environments.

from zycore-c.

athre0z avatar athre0z commented on June 10, 2024

Yeah, was thinking the same thing when reading the patch: let's do that! Maybe ZYAN_64_BIT_ARCH? ZYAN_ARCH64 would be fine as well if ARM folks hadn't decided to call their ISA AARCH64... 😅

from zycore-c.

yuzibo avatar yuzibo commented on June 10, 2024

Hi, many thanks for working on this.
Please feel free to tell me if there need me to do some tests on real riscv64 hardware(Unmatched board). Or:
Applying for accessing to real riscv64 hardware(Unmatched board also) from here:
https://github.com/plctlab/riscv-lab-access

from zycore-c.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.