fixed htonl
This commit is contained in:
Родитель
e9a8ed85db
Коммит
51aaccd026
|
@ -6295,7 +6295,7 @@ LibraryManager.library = {
|
|||
|
||||
htonl: function(value) {
|
||||
return ((value & 0xff) << 24) + ((value & 0xff00) << 8) +
|
||||
((value & 0xff0000) >> 8) + ((value & 0xff000000) >> 24);
|
||||
((value & 0xff0000) >>> 8) + ((value & 0xff000000) >>> 24);
|
||||
},
|
||||
htons: function(value) {
|
||||
return ((value & 0xff) << 8) + ((value & 0xff00) >> 8);
|
||||
|
|
|
@ -5013,11 +5013,11 @@ def process(filename):
|
|||
#include <arpa/inet.h>
|
||||
|
||||
int main() {
|
||||
printf("*%x,%x,%x,%x*\n", htonl(0x12345678), htons(0xabcd), ntohl(0x43211234), ntohs(0xbeaf));
|
||||
printf("*%x,%x,%x,%x*\n", htonl(0xa1b2c3d4), htons(0xabcd), ntohl(0x43211234), ntohs(0xbeaf));
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
self.do_run(src, '*78563412,cdab,34122143,afbe*')
|
||||
self.do_run(src, '*d4c3b2a1,cdab,34122143,afbe*')
|
||||
|
||||
def test_ctype(self):
|
||||
# The bit fiddling done by the macros using __ctype_b_loc requires this.
|
||||
|
|
Загрузка…
Ссылка в новой задаче