Skip to content

Commit

Permalink
fix: remove namespaced header include (issue 419) (#422)
Browse files Browse the repository at this point in the history
* fix: remove namespaced header include (issue 419)

* fix: move header at the right location

* fix: make risc-v isa detection nicer
  • Loading branch information
lemire committed May 8, 2024
1 parent 2044c6e commit 6450172
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions include/simdutf/internal/isadetection.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ POSSIBILITY OF SUCH DAMAGE.

#include "simdutf/portability.h"

// RISC-V ISA detection utilities
#if SIMDUTF_IS_RISCV64 && defined(__linux__)
#include <unistd.h> // for syscall
// We define these ourselves, for backwards compatibility
struct simdutf_riscv_hwprobe { int64_t key; uint64_t value; };
#define simdutf_riscv_hwprobe(...) syscall(258, __VA_ARGS__)
#define SIMDUTF_RISCV_HWPROBE_KEY_IMA_EXT_0 4
#define SIMDUTF_RISCV_HWPROBE_IMA_V (1 << 2)
#define SIMDUTF_RISCV_HWPROBE_EXT_ZVBB (1 << 17)
#endif // SIMDUTF_IS_RISCV64 && defined(__linux__)

namespace simdutf {
namespace internal {

Expand Down Expand Up @@ -90,17 +101,6 @@ static inline uint32_t detect_supported_architectures() {

#elif SIMDUTF_IS_RISCV64

#if defined(__linux__)

#include <unistd.h>
// We define these our selfs, for backwards compatibility
struct simdutf_riscv_hwprobe { int64_t key; uint64_t value; };
#define simdutf_riscv_hwprobe(...) syscall(258, __VA_ARGS__)
#define SIMDUTF_RISCV_HWPROBE_KEY_IMA_EXT_0 4
#define SIMDUTF_RISCV_HWPROBE_IMA_V (1 << 2)
#define SIMDUTF_RISCV_HWPROBE_EXT_ZVBB (1 << 17)
#endif

static inline uint32_t detect_supported_architectures() {
uint32_t host_isa = instruction_set::DEFAULT;
#if SIMDUTF_IS_RVV
Expand Down

0 comments on commit 6450172

Please sign in to comment.