-
-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
632 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"viem": minor | ||
--- | ||
|
||
Exported number constants (ie. `maxInt128`, `maxUint256`, etc). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import { expect, test } from 'vitest' | ||
|
||
import * as number from './number.js' | ||
|
||
test('exports number', () => { | ||
expect(number).toMatchInlineSnapshot(` | ||
{ | ||
"maxInt104": 10141204801825835211973625643008n, | ||
"maxInt112": 2596148429267413814265248164610048n, | ||
"maxInt120": 664613997892457936451903530140172288n, | ||
"maxInt128": 170141183460469231731687303715884105728n, | ||
"maxInt136": 43556142965880123323311949751266331066368n, | ||
"maxInt144": 11150372599265311570767859136324180752990208n, | ||
"maxInt152": 2854495385411919762116571938898990272765493248n, | ||
"maxInt16": 32768n, | ||
"maxInt160": 730750818665451459101842416358141509827966271488n, | ||
"maxInt168": 187072209578355573530071658587684226515959365500928n, | ||
"maxInt176": 47890485652059026823698344598447161988085597568237568n, | ||
"maxInt184": 12259964326927110866866776217202473468949912977468817408n, | ||
"maxInt192": 3138550867693340381917894711603833208051177722232017256448n, | ||
"maxInt200": 803469022129495137770981046170581301261101496891396417650688n, | ||
"maxInt208": 205688069665150755269371147819668813122841983204197482918576128n, | ||
"maxInt216": 52656145834278593348959013841835216159447547700274555627155488768n, | ||
"maxInt224": 13479973333575319897333507543509815336818572211270286240551805124608n, | ||
"maxInt232": 3450873173395281893717377931138512726225554486085193277581262111899648n, | ||
"maxInt24": 8388608n, | ||
"maxInt240": 883423532389192164791648750371459257913741948437809479060803100646309888n, | ||
"maxInt248": 226156424291633194186662080095093570025917938800079226639565593765455331328n, | ||
"maxInt256": 57896044618658097711785492504343953926634992332820282019728792003956564819968n, | ||
"maxInt32": 2147483648n, | ||
"maxInt40": 549755813888n, | ||
"maxInt48": 140737488355328n, | ||
"maxInt56": 36028797018963968n, | ||
"maxInt64": 9223372036854775808n, | ||
"maxInt72": 2361183241434822606848n, | ||
"maxInt8": 128n, | ||
"maxInt80": 604462909807314587353088n, | ||
"maxInt88": 154742504910672534362390528n, | ||
"maxInt96": 39614081257132168796771975168n, | ||
"maxUint104": 20282409603651670423947251286016n, | ||
"maxUint112": 5192296858534827628530496329220096n, | ||
"maxUint120": 1329227995784915872903807060280344576n, | ||
"maxUint128": 340282366920938463463374607431768211456n, | ||
"maxUint136": 87112285931760246646623899502532662132736n, | ||
"maxUint144": 22300745198530623141535718272648361505980416n, | ||
"maxUint152": 5708990770823839524233143877797980545530986496n, | ||
"maxUint16": 65536n, | ||
"maxUint160": 1461501637330902918203684832716283019655932542976n, | ||
"maxUint168": 374144419156711147060143317175368453031918731001856n, | ||
"maxUint176": 95780971304118053647396689196894323976171195136475136n, | ||
"maxUint184": 24519928653854221733733552434404946937899825954937634816n, | ||
"maxUint192": 6277101735386680763835789423207666416102355444464034512896n, | ||
"maxUint200": 1606938044258990275541962092341162602522202993782792835301376n, | ||
"maxUint208": 411376139330301510538742295639337626245683966408394965837152256n, | ||
"maxUint216": 105312291668557186697918027683670432318895095400549111254310977536n, | ||
"maxUint224": 26959946667150639794667015087019630673637144422540572481103610249216n, | ||
"maxUint232": 6901746346790563787434755862277025452451108972170386555162524223799296n, | ||
"maxUint24": 16777216n, | ||
"maxUint240": 1766847064778384329583297500742918515827483896875618958121606201292619776n, | ||
"maxUint248": 452312848583266388373324160190187140051835877600158453279131187530910662656n, | ||
"maxUint256": 115792089237316195423570985008687907853269984665640564039457584007913129639936n, | ||
"maxUint32": 4294967296n, | ||
"maxUint40": 1099511627776n, | ||
"maxUint48": 281474976710656n, | ||
"maxUint56": 72057594037927936n, | ||
"maxUint64": 18446744073709551616n, | ||
"maxUint72": 4722366482869645213696n, | ||
"maxUint8": 256n, | ||
"maxUint80": 1208925819614629174706176n, | ||
"maxUint88": 309485009821345068724781056n, | ||
"maxUint96": 79228162514264337593543950336n, | ||
"minInt104": -20282409603651670423947251286016n, | ||
"minInt112": -5192296858534827628530496329220096n, | ||
"minInt120": -1329227995784915872903807060280344576n, | ||
"minInt128": -340282366920938463463374607431768211456n, | ||
"minInt136": -87112285931760246646623899502532662132736n, | ||
"minInt144": -22300745198530623141535718272648361505980416n, | ||
"minInt152": -5708990770823839524233143877797980545530986496n, | ||
"minInt16": -65536n, | ||
"minInt160": -1461501637330902918203684832716283019655932542976n, | ||
"minInt168": -374144419156711147060143317175368453031918731001856n, | ||
"minInt176": -95780971304118053647396689196894323976171195136475136n, | ||
"minInt184": -24519928653854221733733552434404946937899825954937634816n, | ||
"minInt192": -6277101735386680763835789423207666416102355444464034512896n, | ||
"minInt200": -1606938044258990275541962092341162602522202993782792835301376n, | ||
"minInt208": -411376139330301510538742295639337626245683966408394965837152256n, | ||
"minInt216": -105312291668557186697918027683670432318895095400549111254310977536n, | ||
"minInt224": -26959946667150639794667015087019630673637144422540572481103610249216n, | ||
"minInt232": -6901746346790563787434755862277025452451108972170386555162524223799296n, | ||
"minInt24": -16777216n, | ||
"minInt240": -1766847064778384329583297500742918515827483896875618958121606201292619776n, | ||
"minInt248": -452312848583266388373324160190187140051835877600158453279131187530910662656n, | ||
"minInt256": -115792089237316195423570985008687907853269984665640564039457584007913129639936n, | ||
"minInt32": -4294967296n, | ||
"minInt40": -1099511627776n, | ||
"minInt48": -281474976710656n, | ||
"minInt56": -72057594037927936n, | ||
"minInt64": -18446744073709551616n, | ||
"minInt72": -4722366482869645213696n, | ||
"minInt8": -256n, | ||
"minInt80": -1208925819614629174706176n, | ||
"minInt88": -309485009821345068724781056n, | ||
"minInt96": -79228162514264337593543950336n, | ||
} | ||
`) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
export const maxInt8 = 2n ** (8n - 1n) | ||
export const maxInt16 = 2n ** (16n - 1n) | ||
export const maxInt24 = 2n ** (24n - 1n) | ||
export const maxInt32 = 2n ** (32n - 1n) | ||
export const maxInt40 = 2n ** (40n - 1n) | ||
export const maxInt48 = 2n ** (48n - 1n) | ||
export const maxInt56 = 2n ** (56n - 1n) | ||
export const maxInt64 = 2n ** (64n - 1n) | ||
export const maxInt72 = 2n ** (72n - 1n) | ||
export const maxInt80 = 2n ** (80n - 1n) | ||
export const maxInt88 = 2n ** (88n - 1n) | ||
export const maxInt96 = 2n ** (96n - 1n) | ||
export const maxInt104 = 2n ** (104n - 1n) | ||
export const maxInt112 = 2n ** (112n - 1n) | ||
export const maxInt120 = 2n ** (120n - 1n) | ||
export const maxInt128 = 2n ** (128n - 1n) | ||
export const maxInt136 = 2n ** (136n - 1n) | ||
export const maxInt144 = 2n ** (144n - 1n) | ||
export const maxInt152 = 2n ** (152n - 1n) | ||
export const maxInt160 = 2n ** (160n - 1n) | ||
export const maxInt168 = 2n ** (168n - 1n) | ||
export const maxInt176 = 2n ** (176n - 1n) | ||
export const maxInt184 = 2n ** (184n - 1n) | ||
export const maxInt192 = 2n ** (192n - 1n) | ||
export const maxInt200 = 2n ** (200n - 1n) | ||
export const maxInt208 = 2n ** (208n - 1n) | ||
export const maxInt216 = 2n ** (216n - 1n) | ||
export const maxInt224 = 2n ** (224n - 1n) | ||
export const maxInt232 = 2n ** (232n - 1n) | ||
export const maxInt240 = 2n ** (240n - 1n) | ||
export const maxInt248 = 2n ** (248n - 1n) | ||
export const maxInt256 = 2n ** (256n - 1n) | ||
|
||
export const minInt8 = -(2n ** 8n) | ||
export const minInt16 = -(2n ** 16n) | ||
export const minInt24 = -(2n ** 24n) | ||
export const minInt32 = -(2n ** 32n) | ||
export const minInt40 = -(2n ** 40n) | ||
export const minInt48 = -(2n ** 48n) | ||
export const minInt56 = -(2n ** 56n) | ||
export const minInt64 = -(2n ** 64n) | ||
export const minInt72 = -(2n ** 72n) | ||
export const minInt80 = -(2n ** 80n) | ||
export const minInt88 = -(2n ** 88n) | ||
export const minInt96 = -(2n ** 96n) | ||
export const minInt104 = -(2n ** 104n) | ||
export const minInt112 = -(2n ** 112n) | ||
export const minInt120 = -(2n ** 120n) | ||
export const minInt128 = -(2n ** 128n) | ||
export const minInt136 = -(2n ** 136n) | ||
export const minInt144 = -(2n ** 144n) | ||
export const minInt152 = -(2n ** 152n) | ||
export const minInt160 = -(2n ** 160n) | ||
export const minInt168 = -(2n ** 168n) | ||
export const minInt176 = -(2n ** 176n) | ||
export const minInt184 = -(2n ** 184n) | ||
export const minInt192 = -(2n ** 192n) | ||
export const minInt200 = -(2n ** 200n) | ||
export const minInt208 = -(2n ** 208n) | ||
export const minInt216 = -(2n ** 216n) | ||
export const minInt224 = -(2n ** 224n) | ||
export const minInt232 = -(2n ** 232n) | ||
export const minInt240 = -(2n ** 240n) | ||
export const minInt248 = -(2n ** 248n) | ||
export const minInt256 = -(2n ** 256n) | ||
|
||
export const maxUint8 = 2n ** 8n | ||
export const maxUint16 = 2n ** 16n | ||
export const maxUint24 = 2n ** 24n | ||
export const maxUint32 = 2n ** 32n | ||
export const maxUint40 = 2n ** 40n | ||
export const maxUint48 = 2n ** 48n | ||
export const maxUint56 = 2n ** 56n | ||
export const maxUint64 = 2n ** 64n | ||
export const maxUint72 = 2n ** 72n | ||
export const maxUint80 = 2n ** 80n | ||
export const maxUint88 = 2n ** 88n | ||
export const maxUint96 = 2n ** 96n | ||
export const maxUint104 = 2n ** 104n | ||
export const maxUint112 = 2n ** 112n | ||
export const maxUint120 = 2n ** 120n | ||
export const maxUint128 = 2n ** 128n | ||
export const maxUint136 = 2n ** 136n | ||
export const maxUint144 = 2n ** 144n | ||
export const maxUint152 = 2n ** 152n | ||
export const maxUint160 = 2n ** 160n | ||
export const maxUint168 = 2n ** 168n | ||
export const maxUint176 = 2n ** 176n | ||
export const maxUint184 = 2n ** 184n | ||
export const maxUint192 = 2n ** 192n | ||
export const maxUint200 = 2n ** 200n | ||
export const maxUint208 = 2n ** 208n | ||
export const maxUint216 = 2n ** 216n | ||
export const maxUint224 = 2n ** 224n | ||
export const maxUint232 = 2n ** 232n | ||
export const maxUint240 = 2n ** 240n | ||
export const maxUint248 = 2n ** 248n | ||
export const maxUint256 = 2n ** 256n |
Oops, something went wrong.
28a8212
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
viem – ./
viem-wagmi-dev.vercel.app
viem-site.vercel.app
www.viem.sh
viem.vercel.app
viem-git-main-wagmi-dev.vercel.app
viem.sh