Skip to content

Keep long bigint literals in hexadecimal format #4165

@KimlikDAO-bot

Description

@KimlikDAO-bot

Long bigint literals written in hexadecimal format (such as 0x123456789ABDEFn) should be kept as is. Currently GCC expands them to decimal bigint literals, which increases the compiled size significantly (up to ~20%).

Example:

const P = 0x2fadbe2852044d028597455bc2abbd1bc873af205dfabb8a304600f3e09eeba8n;
console.log(P);

is transformed to

console.log(21565680844461314807147611702860246336805372493508489110556896454939225549736n)

Many crypto libraries (hashing, verifiable computation, etc) include long list of large constants. Keeping such constants in hexadecimal form makes a big difference.

Writing the literals as BigInt("0xabc") is a workaround but is not ideal due to increased compiled size and runtime cost.

This incurs up to 20% blow up in compiled code size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3help wantedinternal-issue-createdAn internal Google issue has been created to track this GitHub issuetriage-doneHas been reviewed by someone on triage rotation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions