Skip to content

Commit ef0926c

Browse files
committed
os: use IsBigEndian() in GetEndianness() function
1 parent d02f228 commit ef0926c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/node_os.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ using namespace v8;
5050

5151
static Handle<Value> GetEndianness(const Arguments& args) {
5252
HandleScope scope(node_isolate);
53-
int i = 1;
54-
bool big = (*(char *)&i) == 0;
55-
Local<String> endianness = String::New(big ? "BE" : "LE");
56-
return scope.Close(endianness);
53+
return scope.Close(String::New(IsBigEndian() ? "BE" : "LE"));
5754
}
5855

5956
static Handle<Value> GetHostname(const Arguments& args) {

0 commit comments

Comments
 (0)