Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Byte-wise comparison of HEAD, GET, etc. #37

Open
zachriggle opened this issue Jul 13, 2018 · 1 comment
Open

Byte-wise comparison of HEAD, GET, etc. #37

zachriggle opened this issue Jul 13, 2018 · 1 comment

Comments

@zachriggle
Copy link

zachriggle commented Jul 13, 2018

Why do a byte-wise comparison of these? Some can be DWORD compares, and all of them could be a cmpsb loop instead of being manually unrolled.

asmttpd/http.asm

Lines 366 to 384 in b5addaf

check_get:
cmp byte[rdi+0], 0x47
jne check_head
cmp byte[rdi+1], 0x45
jne check_head
cmp byte[rdi+2], 0x54
jne check_head
mov rax, REQ_GET
check_head:
cmp byte[rdi+0], 0x48
jne request_type_return
cmp byte[rdi+1], 0x45
jne request_type_return
cmp byte[rdi+2], 0x41
jne request_type_return
cmp byte[rdi+3], 0x44
jne request_type_return
mov rax, REQ_HEAD

@nemasu
Copy link
Owner

nemasu commented Jul 15, 2018

Ah neat, I'll take a look, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants