zoukankan      html  css  js  c++  java
  • find_first_zero_bit在使用gcc 4.2.4 编译时,需要保护%eax

    1.3.100

    find_first_zero_bit在使用gcc 4.2.4 编译时,需要保护%eax

    find_first_zero_bit 修订后:

    /*
     * Find-bit routines..
     */
    extern __inline__ int find_first_zero_bit(void * addr, unsigned size)
    {
        int res;

        if (!size)
            return 0;
        __asm__ ("cld "
            "pushl %%eax " //fixed:
            "movl $-1,%%eax "
            "xorl %%edx,%%edx "
            "repe; scasl "
            "je 1f "
            "xorl -4(%%edi),%%eax "
            "subl $4,%%edi "
            "bsfl %%eax,%%edx "
            "1: subl %%ebx,%%edi "
            "shll $3,%%edi "
            "addl %%edi,%%edx "
            "popl %%eax"
            :"=d" (res)
            :"c" ((size + 31) >> 5), "D" (addr), "b" (addr)
            /*:"ax", "cx", "di"*/);
        return res;
    }

  • 相关阅读:
    架构师之路
    责任链设计模式
    Junit框架分析
    线程详解
    课程总结
    IO流
    Java第四次作业
    Character string
    实训
    实训SI
  • 原文地址:https://www.cnblogs.com/mull/p/8036698.html
Copyright © 2011-2022 走看看