From efbcce0ffe7eff21d64a612b30609fde5348e45c Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Fri, 23 Jan 2015 13:53:02 +0100 Subject: [PATCH] use bitfields to reduce struct size of segment information. size goes down from 28->24 bytes --- data_structures/segment_information.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/data_structures/segment_information.hpp b/data_structures/segment_information.hpp index 117bd3972..d9f84e089 100644 --- a/data_structures/segment_information.hpp +++ b/data_structures/segment_information.hpp @@ -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 */