assemble how to merge two 8-bit data into one 16-bit a7b7a6b6a5b5. A0b0)?
assemble how to merge two 8-bit data into one 16-bit a7b7a6b6a5b5. A0b0)?
short foo(char a_8,char b_8) {
    short a_16=a_8,b_16=b_8;
    short a=0,b=0,result;
    for(short i=0,mask=1;i<8;iPP){
        a+=(a_16&mask)<<i;
        b+=(b_16&mask)<<i;
        printf("%d,%d\n",a_16&mask,a_16);
        mask<<=1;
    }
    result=a<<1+b;
    return result;
}gcc
foo(char, char):
        push    rbp
        mov     rbp, rsp
        mov     eax, edi
        mov     edx, esi
        mov     BYTE PTR [rbp-20], al
        mov     eax, edx
        mov     BYTE PTR [rbp-24], al
        movsx   ax, BYTE PTR [rbp-20]
        mov     WORD PTR [rbp-10], ax
        movsx   ax, BYTE PTR [rbp-24]
        mov     WORD PTR [rbp-12], ax
        mov     WORD PTR [rbp-2], 0
        mov     WORD PTR [rbp-4], 0
        mov     WORD PTR [rbp-6], 0
        mov     WORD PTR [rbp-8], 1
.L3:
        cmp     WORD PTR [rbp-6], 7
        jg      .L2
        movzx   eax, WORD PTR [rbp-10]
        and     ax, WORD PTR [rbp-8]
        movsx   edx, ax
        movsx   eax, WORD PTR [rbp-6]
        mov     ecx, eax
        sal     edx, cl
        mov     eax, edx
        mov     edx, eax
        movzx   eax, WORD PTR [rbp-2]
        add     eax, edx
        mov     WORD PTR [rbp-2], ax
        movzx   eax, WORD PTR [rbp-12]
        and     ax, WORD PTR [rbp-8]
        movsx   edx, ax
        movsx   eax, WORD PTR [rbp-6]
        mov     ecx, eax
        sal     edx, cl
        mov     eax, edx
        mov     edx, eax
        movzx   eax, WORD PTR [rbp-4]
        add     eax, edx
        mov     WORD PTR [rbp-4], ax
        movsx   eax, WORD PTR [rbp-8]
        add     eax, eax
        mov     WORD PTR [rbp-8], ax
        movzx   eax, WORD PTR [rbp-6]
        add     eax, 1
        mov     WORD PTR [rbp-6], ax
        jmp     .L3
.L2:
        movsx   edx, WORD PTR [rbp-2]
        movsx   eax, WORD PTR [rbp-4]
        add     eax, 1
        mov     ecx, eax
        sal     edx, cl
        mov     eax, edx
        mov     WORD PTR [rbp-14], ax
        movzx   eax, WORD PTR [rbp-14]
        pop     rbp
        retclang
foo(char, char):                               -sharp @foo(char, char)
        push    rbp
        mov     rbp, rsp
        mov     al, sil
        mov     cl, dil
        mov     byte ptr [rbp - 1], cl
        mov     byte ptr [rbp - 2], al
        movsx   esi, byte ptr [rbp - 1]
        mov     dx, si
        mov     word ptr [rbp - 4], dx
        movsx   esi, byte ptr [rbp - 2]
        mov     dx, si
        mov     word ptr [rbp - 6], dx
        mov     word ptr [rbp - 8], 0
        mov     word ptr [rbp - 10], 0
        mov     word ptr [rbp - 14], 0
        mov     word ptr [rbp - 16], 1
.LBB0_1:                                -sharp =>This Inner Loop Header: Depth=1
        movsx   eax, word ptr [rbp - 14]
        cmp     eax, 8
        jge     .LBB0_4
        movsx   eax, word ptr [rbp - 4]
        movsx   ecx, word ptr [rbp - 16]
        and     eax, ecx
        movsx   ecx, word ptr [rbp - 14]
        shl     eax, cl
        movsx   edx, word ptr [rbp - 8]
        add     edx, eax
        mov     si, dx
        mov     word ptr [rbp - 8], si
        movsx   eax, word ptr [rbp - 6]
        movsx   edx, word ptr [rbp - 16]
        and     eax, edx
        movsx   ecx, word ptr [rbp - 14]
        shl     eax, cl
        movsx   edx, word ptr [rbp - 10]
        add     edx, eax
        mov     si, dx
        mov     word ptr [rbp - 10], si
        movsx   eax, word ptr [rbp - 16]
        shl     eax, 1
        mov     si, ax
        mov     word ptr [rbp - 16], si
        mov     ax, word ptr [rbp - 14]
        add     ax, 1
        mov     word ptr [rbp - 14], ax
        jmp     .LBB0_1
.LBB0_4:
        movsx   eax, word ptr [rbp - 8]
        movsx   ecx, word ptr [rbp - 10]
        add     ecx, 1
        shl     eax, cl
        mov     dx, ax
        mov     word ptr [rbp - 12], dx
        movsx   eax, word ptr [rbp - 12]
        pop     rbp
        retPrevious: Ambari Metrics Collector startup failed
Next: Vscode supports less and html tag auto-completion is not compatible?
1. There are two problems: (1) the breakpoint is set, but the console window flashes when debugging, and the subsystem in the linker option has been selected as the console, and the platform is set to all platforms; (2) when generating project, the ou...
the code in Jasmine, the SetTimeout method in this Function.prototype.apply.apply if (queueableFn.timeout) { timeoutId = Function.prototype.apply.apply(self.timeout.setTimeout, [j$.getGlobal(), [function() { var error = new Error( Timeout - ...
Test environment: 1, test environment win7, node v8.9.4 chrome65.0.3325.181 (64-bit) firefox60.0.1 (64-bit) notebook memory 8G 2, large background management system front-end page developed for angular4.4.6. The UT test uses karma1.7.0+jasmine2.6.2. T...
could you tell me what s wrong with my writing like this? there is no result at run time data segment data ends stack segment stack dw 20h dup(?) top label word stack ends code segment assume ds:data,ss:stack,cs:code p proc far mov ax,data ...
as shown in the figure, mount only renders one layer. How does dom, render the second layer? Because the need for the table traversal after the simulation click, the second layer does not render can not get the elements, can not be traversed! ...
File is executable. test executable 1, pyinstxtractor use pyinstxtractor to report errors Error: Unsupported pyinstaller version or not a pyinstaller archive 2, uncompyle6 change the file name suffix to .pyc or pyo, uses uncompyle6 to report a...
< H2 > 8259A Programmable interrupt Controller Port problem < H2 > ICW4 and OCW3 A total of 56 bytes need to be written, and its port is only 0x20,0x21 0xa0,0xa1 four ports, these ports are also one byte, how to write these 56 bytes into th...
I dynamically loaded a piece of code into memory for execution and reported to SIGSEGV. Debug with gdb and find a strange phenomenon: first of all, the environment is: (gdb) bt -sharp0 0x00007ffff7e91360 in ?? () (gdb) i r ... rip 0x7ffff7e91360 cs ...
since the network IO is based on interrupt DMAcopy , why do we need the in out instruction to read data directly from the NIC register? ...