Skip to content

Really fix airport_up_time#833

Merged
zxystd merged 1 commit into
OpenIntelWireless:masterfrom
usr-sse2:airport_up_time
Dec 7, 2022
Merged

Really fix airport_up_time#833
zxystd merged 1 commit into
OpenIntelWireless:masterfrom
usr-sse2:airport_up_time

Conversation

@usr-sse2
Copy link
Copy Markdown
Contributor

@usr-sse2 usr-sse2 commented Dec 7, 2022

0x10624DD3LL is just a constant used for optimized division by 1000: http://flaviojslab.blogspot.com/2008/02/integer-division.html
There is no need to write it in code, because the compiler does constant division optimization by itself.
Here is the assembly code that I get after compiling my variant:

__ZL15airport_up_timev:
00000000000149e0        pushq   %rbp
00000000000149e1        movq    %rsp, %rbp
00000000000149e4        subq    $0x20, %rsp
00000000000149e8        leaq    -0x10(%rbp), %rdi
00000000000149ec        xorl    %esi, %esi
00000000000149ee        movl    $0x10, %edx
00000000000149f3        callq   _memset
00000000000149f8        movq    $0x0, -0x18(%rbp)
0000000000014a00        leaq    -0x10(%rbp), %rdi
0000000000014a04        callq   _microuptime
0000000000014a09        imull   $0x10624dd3, -0x8(%rbp), %eax   ## imm = 0x10624DD3
0000000000014a10        movl    %eax, %eax
0000000000014a12        movq    %rax, -0x18(%rbp)
0000000000014a16        movq    -0x18(%rbp), %rax
0000000000014a1a        shrq    $0x3f, %rax
0000000000014a1e        movq    -0x18(%rbp), %rcx
0000000000014a22        shrq    $0x26, %rcx
0000000000014a26        addq    %rcx, %rax
0000000000014a29        imulq   $0x3e8, -0x10(%rbp), %rcx       ## imm = 0x3E8
0000000000014a31        addq    %rcx, %rax
0000000000014a34        addq    $0x20, %rsp
0000000000014a38        popq    %rbp
0000000000014a39        retq
0000000000014a3a        nopw    (%rax,%rax)

@zxystd
Copy link
Copy Markdown
Collaborator

zxystd commented Dec 7, 2022

It should be what I have misunderstood, thank you.

@zxystd zxystd merged commit 640bcf8 into OpenIntelWireless:master Dec 7, 2022
@usr-sse2 usr-sse2 deleted the airport_up_time branch December 7, 2022 14:39
DexterSLamb pushed a commit to DexterSLamb/itlwm that referenced this pull request May 3, 2026
Co-authored-by: Michael Belyaev <usrsse2@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants