Skip to content

Broken on 32 bit big endian #12199

@kroeckx

Description

@kroeckx

This code does not work on 32 bit big endian machines:

# define DECLARE_IS_ENDIAN \
const union { \
long one; \
char little; \
} ossl_is_endian = { 1 }
# define IS_LITTLE_ENDIAN (ossl_is_endian.little != 0)
# define IS_BIG_ENDIAN (ossl_is_endian.little == 0)

I think it just needs to be changed to an int. But I wonder if we have other code like that that uses a long instead of an int. Maybe all that code should use that macro.

gcc also has built in macro's for that, I suggest we use that by default instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triaged: bugThe issue/pr is/fixes a bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions