Changeset 15713
- Timestamp:
- 2008-05-27T12:54:40+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/util.pm
r15165 r15713 748 748 749 749 # test to see whether this is a big or little endian machine 750 sub is_little_endian { 751 # To determine the name of the operating system, the variable $^O is a cheap alternative to pulling it out of the Config module; 752 # What we do here is, if it is a Macintosh machine (i.e. the Darwin operating system), regardless it is running on the IBM power-pc cpu or it is the x86 Intel-based chip with a power-pc emulator running on top of it, it requires the big-endian data format in the gdbm database file, we make the file extension .bdb; otherwise it's .ldb extension. 753 754 #return 0 if $^O =~ /^darwin$/i; 755 return 0 if $ENV{'GSDLOS'} =~ /^darwin$/i; 756 return (ord(substr(pack("s",1), 0, 1)) == 1); 750 sub is_little_endian 751 { 752 # To determine the name of the operating system, the variable $^O is a cheap alternative to pulling it out of the Config module; 753 # If it is a Macintosh machine (i.e. the Darwin operating system), regardless if it's running on the IBM power-pc cpu or the x86 Intel-based chip with a power-pc emulator running on top of it, it's big-endian 754 # Otherwise, it's little endian 755 756 #return 0 if $^O =~ /^darwin$/i; 757 return 0 if $ENV{'GSDLOS'} =~ /^darwin$/i; 758 return (ord(substr(pack("s",1), 0, 1)) == 1); 757 759 } 758 760
Note:
See TracChangeset
for help on using the changeset viewer.