Skip to content

shift bug #1

@avater210

Description

@avater210

移位逻辑上是>=32移出去就好,但是在x86上shr shl等指令实现是只看寄存器或者变量的后5位,其它位mask掉,即只支持0-31,我看这里考虑了右移,左移也会有问题同样问题。

if (bb.logBinary.exp >= 127)
dx = dx << (bb.logBinary.exp - 127);
else if (bb.logBinary.exp >= 103)
// dx >> 32 is dx in msvc.
dx = dx >> (127 - bb.logBinary.exp);
else
dx = 0;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions