小编Cha*_*aal的帖子

如何加快这种插入排序?(C中的内联汇编)

因此,此插入排序是用x86编写的,但嵌入在C中。它还具有一个标志,在对数组的一半进行排序后,我们将其设置为保留。有什么办法可以提高性能?

void asmInsSort(int *list, int arrayLen, int halfpoint) {
 _asm
 {

    mov ecx, arrayLen
    mov esi, list
    mov ebx, halfpoint
    mov eax, 0

    more:
        cmp ecx, 0              // Compare current arrayLen w/ 0
            je  done            // If it is equal, we are done
        mov edi, eax            //J = I
        push eax                //push eax (i) to free up register for key
        mov eax, [esi + edi]    //Key = Array[i] technically j
        sub edi, 4              //J - 1
        mov edx, arrayLen       //K …
Run Code Online (Sandbox Code Playgroud)

x86 assembly inline-assembly micro-optimization insertion-sort

2
推荐指数
1
解决办法
116
查看次数

如何在不使用任何内置方法或函数的情况下,在恒定时间(O(1))中获取字母(1-26)中字符的数值/位置?

如何在不使用任何内置方法或功能且不关心角色的情况下,在恒定时间(O(1))中获得字母(1-26)中字符的数值/位置?

c c++ java algorithm

-5
推荐指数
2
解决办法
385
查看次数