Skip to content

Commit

Permalink
more sane way of converting to hex
Browse files Browse the repository at this point in the history
  • Loading branch information
aidemsined committed Aug 13, 2024
1 parent 07bb8b5 commit e01aa84
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/functions/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
// SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC

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

export const formatSize = (number: number): string => {
Expand Down

0 comments on commit e01aa84

Please sign in to comment.