bba: Default to native endian in bbasm
Signed-off-by: Marcus Comstedt <marcus@mc.pp.se>
This commit is contained in:
parent
bc6b47efe0
commit
dd40c41ffc
13
bba/main.cc
13
bba/main.cc
@ -66,11 +66,17 @@ const char *skipWhitespace(const char *p)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool testBigEndian()
|
||||||
|
{
|
||||||
|
int n = 1;
|
||||||
|
return !*(const char *)&n;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
bool bigEndian = false;
|
bool bigEndian;
|
||||||
bool writeC = false;
|
bool writeC = false;
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
|
|
||||||
@ -81,6 +87,7 @@ int main(int argc, char **argv)
|
|||||||
options.add_options()("verbose,v", "verbose output");
|
options.add_options()("verbose,v", "verbose output");
|
||||||
options.add_options()("debug,d", "debug output");
|
options.add_options()("debug,d", "debug output");
|
||||||
options.add_options()("be,b", "big endian");
|
options.add_options()("be,b", "big endian");
|
||||||
|
options.add_options()("le,l", "little endian");
|
||||||
options.add_options()("c,c", "write c strings");
|
options.add_options()("c,c", "write c strings");
|
||||||
options.add_options()("files", po::value<std::vector<std::string>>(), "file parameters");
|
options.add_options()("files", po::value<std::vector<std::string>>(), "file parameters");
|
||||||
pos.add("files", -1);
|
pos.add("files", -1);
|
||||||
@ -106,6 +113,10 @@ int main(int argc, char **argv)
|
|||||||
debug = true;
|
debug = true;
|
||||||
if (vm.count("be"))
|
if (vm.count("be"))
|
||||||
bigEndian = true;
|
bigEndian = true;
|
||||||
|
else if (vm.count("le"))
|
||||||
|
bigEndian = false;
|
||||||
|
else
|
||||||
|
bigEndian = testBigEndian();
|
||||||
if (vm.count("c"))
|
if (vm.count("c"))
|
||||||
writeC = true;
|
writeC = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user