diff options
| author | Michael Woerister <michaelwoerister@posteo.net> | 2015-12-25 13:59:02 -0500 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo.net> | 2015-12-28 12:15:44 -0500 |
| commit | fa2a7411e403ec31b426c339c9950af8a1037995 (patch) | |
| tree | 6cac70777036907baec037cdcd5c470ab2e1834e /src/libsyntax | |
| parent | 89753077fc25abb9d04d24a2b2b73984854f7c3a (diff) | |
| download | rust-fa2a7411e403ec31b426c339c9950af8a1037995.tar.gz rust-fa2a7411e403ec31b426c339c9950af8a1037995.zip | |
Use a more efficient encoding for opaque data in RBML.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/codemap.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 18659cb2e78..19236f2cd98 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -164,18 +164,15 @@ impl Eq for Span {} impl Encodable for Span { fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> { - // Encode spans as a single u64 in order to cut down on tagging overhead - // added by the RBML metadata encoding. The should be solved differently - // altogether some time (FIXME #21482) - s.emit_u64( (self.lo.0 as u64) | ((self.hi.0 as u64) << 32) ) + try!(s.emit_u32(self.lo.0)); + s.emit_u32(self.hi.0) } } impl Decodable for Span { fn decode<D: Decoder>(d: &mut D) -> Result<Span, D::Error> { - let lo_hi: u64 = try! { d.read_u64() }; - let lo = BytePos(lo_hi as u32); - let hi = BytePos((lo_hi >> 32) as u32); + let lo = BytePos(try! { d.read_u32() }); + let hi = BytePos(try! { d.read_u32() }); Ok(mk_sp(lo, hi)) } } |
