Skip to content

Add RISC-V unaligned accessΒ #4546

@guoyuqi020

Description

@guoyuqi020

RISC-V C API Specification says that if the C compiler defines __riscv_misaligned_fast, then unaligned access is known to be fast.

Maybe we can update xxhash.h to add unaligned access for some RISC-V machines.

The related code:

zstd/lib/common/xxhash.h

Lines 2254 to 2260 in bfd8ad8

#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */
/* don't check on sizeopt, x86, aarch64, or arm when unaligned access is available */
# if XXH_SIZE_OPT >= 1 || \
defined(__i386) || defined(__x86_64__) || defined(__aarch64__) || defined(__ARM_FEATURE_UNALIGNED) \
|| defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) || defined(_M_ARM) /* visual */
# define XXH_FORCE_ALIGN_CHECK 0
# else

Metadata

Metadata

Assignees

No one assigned

    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