Skip to content

Commit

Permalink
Fixed Compilation on 32b Platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Redfire75369 committed Sep 7, 2023
1 parent 6e6ed42 commit a8ab9c7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions mozjs/src/jsval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn AssertGCPointerValid(bits: u64) {

#[cfg(target_pointer_width = "32")]
#[inline(always)]
fn AssertIsGCPointerValid(bits: u64) {}
fn AssertGCPointerValid(bits: u64) {}

#[cfg(target_pointer_width = "64")]
#[inline(always)]
Expand Down Expand Up @@ -269,7 +269,6 @@ impl JSVal {
}

#[inline(always)]
#[cfg(target_pointer_width = "64")]
pub fn is_bigint(&self) -> bool {
self.toTag() == ValueTag::BIGINT as u64
}
Expand Down Expand Up @@ -358,27 +357,26 @@ impl JSVal {
}

#[inline(always)]
#[cfg(target_pointer_width = "64")]
pub fn to_string(&self) -> *mut JSString {
assert!(self.is_string());
let ptrBits = self.payload();
AssertGCPointerAlignment(ptrBits);
AssertGCPointerAlignment(ptrBits as u64);
ptrBits as usize as *mut JSString
}

#[inline(always)]
pub fn to_symbol(&self) -> *mut Symbol {
assert!(self.is_symbol());
let ptrBits = self.payload();
AssertGCPointerAlignment(ptrBits);
AssertGCPointerAlignment(ptrBits as u64);
ptrBits as usize as *mut Symbol
}

#[inline(always)]
pub fn to_bigint(&self) -> *mut BigInt {
assert!(self.is_bigint());
let ptrBits = self.payload();
AssertGCPointerAlignment(ptrBits);
AssertGCPointerAlignment(ptrBits as u64);
ptrBits as usize as *mut BigInt
}

Expand Down Expand Up @@ -409,12 +407,11 @@ impl JSVal {
pub fn to_gcthing(&self) -> *mut c_void {
assert!(self.is_gcthing());
let ptrBits = self.payload();
AssertGCPointerAlignment(ptrBits);
AssertGCPointerAlignment(ptrBits as u64);
ptrBits as *mut c_void
}

#[inline(always)]
#[cfg(target_pointer_width = "64")]
pub fn to_boolean(&self) -> bool {
assert!(self.is_boolean());
self.payload() != 0
Expand Down

0 comments on commit a8ab9c7

Please sign in to comment.