fix(fs): fix compilation on targets with pointer width 16 and 32 (#1958)

This commit is contained in:
bWanShiTong
2024-10-21 14:07:55 +02:00
committed by GitHub
parent 3fd283121f
commit 14cee64c82
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"fs": patch
---
Fix compilation on targets with pointer width of `16` or `32`
+2
View File
@@ -316,12 +316,14 @@ pub async fn read<R: Runtime>(
let nread = nread.to_be_bytes();
let mut out = [0; 8];
out[6..].copy_from_slice(&nread);
out
};
#[cfg(target_pointer_width = "32")]
let nread = {
let nread = nread.to_be_bytes();
let mut out = [0; 8];
out[4..].copy_from_slice(&nread);
out
};
#[cfg(target_pointer_width = "64")]
let nread = nread.to_be_bytes();