use bitfields to reduce struct size of segment information. size goes down from 28->24 bytes
This commit is contained in:
parent
1c2c87e03d
commit
efbcce0ffe
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2014, Project OSRM, Dennis Luxen, others
|
Copyright (c) 2015, Project OSRM, Dennis Luxen, others
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
@ -25,8 +25,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SEGMENT_INFORMATION_H
|
#ifndef SEGMENT_INFORMATION_HPP
|
||||||
#define SEGMENT_INFORMATION_H
|
#define SEGMENT_INFORMATION_HPP
|
||||||
|
|
||||||
#include "turn_instructions.hpp"
|
#include "turn_instructions.hpp"
|
||||||
|
|
||||||
@ -44,9 +44,9 @@ struct SegmentInformation
|
|||||||
float length;
|
float length;
|
||||||
short bearing; // more than enough [0..3600] fits into 12 bits
|
short bearing; // more than enough [0..3600] fits into 12 bits
|
||||||
TurnInstruction turn_instruction;
|
TurnInstruction turn_instruction;
|
||||||
TravelMode travel_mode;
|
TravelMode travel_mode : 4;
|
||||||
bool necessary;
|
bool necessary : 1;
|
||||||
bool is_via_location;
|
bool is_via_location : 1;
|
||||||
|
|
||||||
explicit SegmentInformation(const FixedPointCoordinate &location,
|
explicit SegmentInformation(const FixedPointCoordinate &location,
|
||||||
const NodeID name_id,
|
const NodeID name_id,
|
||||||
@ -75,4 +75,4 @@ struct SegmentInformation
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SEGMENT_INFORMATION_H */
|
#endif /* SEGMENT_INFORMATION_HPP */
|
||||||
|
Loading…
Reference in New Issue
Block a user