use bitfields to reduce struct size of segment information. size goes down from 28->24 bytes

This commit is contained in:
Dennis Luxen 2015-01-23 13:53:02 +01:00
parent 1c2c87e03d
commit efbcce0ffe

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2014, Project OSRM, Dennis Luxen, others
Copyright (c) 2015, Project OSRM, Dennis Luxen, others
All rights reserved.
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
#define SEGMENT_INFORMATION_H
#ifndef SEGMENT_INFORMATION_HPP
#define SEGMENT_INFORMATION_HPP
#include "turn_instructions.hpp"
@ -44,9 +44,9 @@ struct SegmentInformation
float length;
short bearing; // more than enough [0..3600] fits into 12 bits
TurnInstruction turn_instruction;
TravelMode travel_mode;
bool necessary;
bool is_via_location;
TravelMode travel_mode : 4;
bool necessary : 1;
bool is_via_location : 1;
explicit SegmentInformation(const FixedPointCoordinate &location,
const NodeID name_id,
@ -75,4 +75,4 @@ struct SegmentInformation
}
};
#endif /* SEGMENT_INFORMATION_H */
#endif /* SEGMENT_INFORMATION_HPP */