Log endianness when dumping memory stats
This commit is contained in:
parent
215f246974
commit
4d052a7e71
1 changed files with 11 additions and 11 deletions
22
quickjs.c
22
quickjs.c
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue