diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2011-07-20 19:34:52 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2011-07-20 19:34:52 -0700 |
| commit | 45748a3be4275258ada5ca23b09c6b2f0122ca3f (patch) | |
| tree | ac805cbcb98d86a595653a6ac03c26c9692f4671 | |
| parent | 355f77ef87bec89f37e77e751a530e418e62fe2c (diff) | |
| download | rust-45748a3be4275258ada5ca23b09c6b2f0122ca3f.tar.gz rust-45748a3be4275258ada5ca23b09c6b2f0122ca3f.zip | |
rustc: Implement ptr_eq in Rust. Shaves 4 s off compile time.
| -rw-r--r-- | src/lib/box.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/box.rs b/src/lib/box.rs index 0435c40f474..fb994858bf9 100644 --- a/src/lib/box.rs +++ b/src/lib/box.rs @@ -1,8 +1,8 @@ export ptr_eq; -native "rust" mod rustrt { - fn rust_ptr_eq[T](@T a, @T b) -> int; +fn ptr_eq[T](&@T a, &@T b) -> bool { + let uint a_ptr = unsafe::reinterpret_cast(a); + let uint b_ptr = unsafe::reinterpret_cast(b); + ret a_ptr == b_ptr; } - -fn ptr_eq[T](@T a, @T b) -> bool { ret rustrt::rust_ptr_eq[T](a, b) != 0; } \ No newline at end of file |
