Skip to content

Instantly share code, notes, and snippets.

@DennisOSRM
Created January 11, 2013 15:35
Show Gist options
  • Save DennisOSRM/4511565 to your computer and use it in GitHub Desktop.
Save DennisOSRM/4511565 to your computer and use it in GitHub Desktop.
Packing is dependent on the order of things
#include <iostream>
#include <boost/integer.hpp>
typedef uint32_t NodeID;
struct EdgeData1 {
unsigned id:31;
bool shortcut:1;
int distance:30;
bool forward:1;
bool backward:1;
};
struct EdgeData2 {
unsigned id:31;
int distance:30;
bool shortcut:1;
bool forward:1;
bool backward:1;
};
int main(int argc, char * argv[]) {
std::cout << "size: " << sizeof(EdgeData1) << std::endl;
std::cout << "size: " << sizeof(EdgeData2) << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment