Skip to content
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

[RUM-1830] Replaced bigint literals with BigInt #684

Merged
merged 1 commit into from
Jul 4, 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
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ export enum TracingIdType {
/**
* Value used to mask the low 64 bits of the trace identifier.
*/
const LOW_64BIT_MASK = (BigInt('0xffffffff') << 32n) + BigInt('0xffffffff');
const LOW_64BIT_MASK =
(BigInt('0xffffffff') << BigInt(32)) + BigInt('0xffffffff');

/**
* Value used to mask the low 32 bits of the trace identifier.
*/
const LOW_32BIT_MASK = (BigInt('0xffff') << 16n) + BigInt('0xffff');
const LOW_32BIT_MASK = (BigInt('0xffff') << BigInt(16)) + BigInt('0xffff');

/**
* A {@link TracingIdentifier} is a unique UUID that can be 64bit or 128bit, and provides
Expand Down Expand Up @@ -181,7 +182,8 @@ export class TracingIdentifier {
public toString(format: TracingIdFormat): string {
const lowTraceMask =
this.type === TracingIdType.trace ? LOW_64BIT_MASK : LOW_32BIT_MASK;
const highTraceMask = this.type === TracingIdType.trace ? 64n : 32n;
const highTraceMask =
this.type === TracingIdType.trace ? BigInt(64) : BigInt(32);
const padding = this.type === TracingIdType.trace ? 32 : 16;

switch (format) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ describe('TracingIdentifier', () => {
it('M return valid string representations for zero ID w toString', () => {
// GIVEN
const tracingId = TracingIdentifier.createTraceId();
(tracingId as any)['id'] = 0n;
(tracingId as any)['id'] = BigInt(0);

// THEN

Expand Down Expand Up @@ -314,7 +314,7 @@ describe('TracingIdentifier', () => {
it('M return valid string representations for zero ID w toString', () => {
// GIVEN
const tracingId = TracingIdentifier.createSpanId();
(tracingId as any)['id'] = 0n;
(tracingId as any)['id'] = BigInt(0);

// THEN

Expand Down
Loading