Skip to content

Commit c18032d

Browse files
Fix compilation error on big endian platforms.
1 parent fdb2267 commit c18032d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

measureme/src/event_id.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ impl EventId {
4444
pub fn from_virtual(virtual_id: StringId) -> EventId {
4545
EventId(virtual_id)
4646
}
47+
48+
/// Create an EventId from a raw u32 value. Only used internally for
49+
/// deserialization.
50+
#[inline]
51+
pub fn from_u32(raw_id: u32) -> EventId {
52+
EventId(StringId::new(raw_id))
53+
}
4754
}
4855

4956
pub struct EventIdBuilder<'p, S: SerializationSink> {

measureme/src/raw_event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ impl RawEvent {
149149
{
150150
use byteorder::{ByteOrder, LittleEndian};
151151
RawEvent {
152-
event_kind: StringId::reserved(LittleEndian::read_u32(&bytes[0..])),
153-
event_id: StringId::reserved(LittleEndian::read_u32(&bytes[4..])),
152+
event_kind: StringId::new(LittleEndian::read_u32(&bytes[0..])),
153+
event_id: EventId::from_u32(LittleEndian::read_u32(&bytes[4..])),
154154
thread_id: LittleEndian::read_u32(&bytes[8..]),
155155
start_time_lower: LittleEndian::read_u32(&bytes[12..]),
156156
end_time_lower: LittleEndian::read_u32(&bytes[16..]),

0 commit comments

Comments
 (0)