Browse Source

os: use IsBigEndian() in GetEndianness() function

v0.11.3-release
Ben Noordhuis 12 years ago
parent
commit
ef0926ce42
  1. 5
      src/node_os.cc

5
src/node_os.cc

@ -50,10 +50,7 @@ using namespace v8;
static Handle<Value> GetEndianness(const Arguments& args) { static Handle<Value> GetEndianness(const Arguments& args) {
HandleScope scope(node_isolate); HandleScope scope(node_isolate);
int i = 1; return scope.Close(String::New(IsBigEndian() ? "BE" : "LE"));
bool big = (*(char *)&i) == 0;
Local<String> endianness = String::New(big ? "BE" : "LE");
return scope.Close(endianness);
} }
static Handle<Value> GetHostname(const Arguments& args) { static Handle<Value> GetHostname(const Arguments& args) {

Loading…
Cancel
Save