Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit54a5073

Browse files
committed
chore: use a named constant for max safe int
1 parentc6072b0 commit54a5073

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎src/fs/wasm/file.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,11 @@ impl File {
9090
/// If the requested length is greater than 9007199254740991 (max safe integer in a floating-point context),
9191
/// this will produce an error.
9292
pubasyncfnset_len(&self,size:u64) -> io::Result<()>{
93-
if size >9007199254740991{
93+
constMAX_SAFE_INT:u64 = js_sys::Number::MAX_SAFE_INTEGERas_;
94+
if size >MAX_SAFE_INT{
9495
returnErr(std::io::Error::new(
9596
std::io::ErrorKind::InvalidInput,
96-
format!("requested size {size} too large, max allowed is9007199254740991"),
97+
format!("requested size {size} too large, max allowed is{MAX_SAFE_INT}"),
9798
));
9899
}
99100
self.sync_access_handle

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp