J-jaeyoung / add-nbo

gilgil network class, Network Byte Order

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description

gilgil mentor add-nbo HW

How to compile & test

$ make
$ echo -n -e \\x00\\x00\\x03\\xe8 > sample1.bin
$ echo -n -e \\x00\\x00\\x01\\xf4 > sample2.bin
$ ./add-nbo sample1.bin sample2.bin

Additional (bswap speed test)

bswapmov 의 성능 비교

mov의 CPI가 1일테니, bswap은 CPI가 2일 듯

a mov bswap
time 22.397s 45.331s
$ gcc -o .test/BSWAP .test/bswap.c
$ gcc -o .test/MOV .test/mov.c
$ time .test/BSWAP
$ time .test/MOV

Specification

gilgil_gitlab

Summary

ntohs == htons

ntohl == htonl

result

About

gilgil network class, Network Byte Order


Languages

Language:C 81.4%Language:C++ 16.0%Language:Makefile 2.6%