Skip to content

Commit 18faf08

Browse files
committed
Fix things for 32-bit windows
1 parent 6e45953 commit 18faf08

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/platform/windows/mod.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ impl OsIpcReceiverSet {
10811081
// XXX use GetQueuedCompletionStatusEx to dequeue multiple CP at once!
10821082
let ok = kernel32::GetQueuedCompletionStatus(*self.iocp,
10831083
&mut nbytes,
1084-
&mut completion_key as *mut _ as *mut u64,
1084+
&mut completion_key as *mut _ as *mut winapi::ULONG_PTR,
10851085
&mut ov_ptr,
10861086
winapi::INFINITE);
10871087
dd!("[# {:?}] GetQueuedCS -> ok:{} nbytes:{} key:{:?}", *self.iocp, ok, nbytes, completion_key);
@@ -1226,10 +1226,14 @@ impl Deref for OsIpcSharedMemory {
12261226
}
12271227

12281228
impl OsIpcSharedMemory {
1229+
#[allow(exceeding_bitshifts)]
12291230
fn new(length: usize) -> Result<OsIpcSharedMemory,WinError> {
12301231
unsafe {
1231-
let lhigh = (length >> 32) as u32;
1232-
let llow = (length & 0xffffffffusize) as u32;
1232+
let (lhigh, llow) = if cfg!(target_pointer_width = "64") {
1233+
((length >> 32) as u32, (length & 0xffffffffusize) as u32)
1234+
} else {
1235+
(0, length as u32)
1236+
};
12331237
let handle =
12341238
kernel32::CreateFileMappingA(INVALID_HANDLE_VALUE,
12351239
ptr::null_mut(),

0 commit comments

Comments
 (0)