Skip to content

Add Big Endian CI target #293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@ jobs:
- name: test
run: |
make test
linux-s390x:
runs-on: ubuntu-latest
defaults:
run:
shell: alpine.sh {0}
steps:
- uses: actions/checkout@v3
- uses: jirutka/setup-alpine@v1
with:
arch: s390x
packages: "build-base make cmake"
- name: build
run: |
make
- name: stats
run: |
make stats
- name: test
run: |
make test
linux-gcc48:
runs-on: ubuntu-latest
container:
Expand Down
22 changes: 11 additions & 11 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,15 @@ static inline int is_digit(int c) {
return c >= '0' && c <= '9';
}

static inline BOOL is_be(void)
{
union {
uint16_t a;
uint8_t b;
} u = {0x100};
return u.b;
}

typedef struct JSClassShortDef {
JSAtom class_name;
JSClassFinalizer *finalizer;
Expand Down Expand Up @@ -6148,8 +6157,8 @@ void JS_ComputeMemoryUsage(JSRuntime *rt, JSMemoryUsage *s)

void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt)
{
fprintf(fp, "QuickJS-ng memory usage -- %s version, %d-bit, malloc limit: %"PRId64"\n\n",
JS_GetVersion(), (int)sizeof(void *) * 8, s->malloc_limit);
fprintf(fp, "QuickJS-ng memory usage -- %s version, %d-bit, %s Endian, malloc limit: %"PRId64"\n\n",
JS_GetVersion(), (int)sizeof(void *) * 8, is_be() ? "Big" : "Little", s->malloc_limit);
if (rt) {
static const struct {
const char *name;
Expand Down Expand Up @@ -32335,15 +32344,6 @@ static const char * const bc_tag_str[] = {
};
#endif

static inline BOOL is_be(void)
{
union {
uint16_t a;
uint8_t b;
} u = {0x100};
return u.b;
}

static void bc_put_u8(BCWriterState *s, uint8_t v)
{
dbuf_putc(&s->dbuf, v);
Expand Down