Skip to content

Commit e01aa84

Browse files
committed
more sane way of converting to hex
1 parent 07bb8b5 commit e01aa84

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/functions/math.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
// SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC
44

55
export const toHex = (num: number): string => {
6-
if (num < 0) {
7-
return toHex(0xffffffff + num + 1);
8-
}
9-
return `0x${num.toString(16).toUpperCase()}`;
6+
// eslint-disable-next-line no-bitwise
7+
return `0x${(num >>> 0).toString(16).toUpperCase()}`;
108
};
119

1210
export const formatSize = (number: number): string => {

0 commit comments

Comments
 (0)