如何在位级别上进行操作?

时间:2015-06-04 21:08:00

标签: c++ binary logic

假设char的大小为1个字节,而负数以2的补码形式存储

type mismatch;
 found   : slick.lifted.Query[T,T#TableElementType,Seq]
 required: slick.driver.MySQLDriver.api.Query[T,R,Seq]
    (which expands to)  slick.lifted.Query[T,R,Seq]
    val fetchByIdQuery: Query[T, R, Seq] = table.filter(row => rowId(row) === id)

答案是-121怎么样?

1 个答案:

答案 0 :(得分:3)

125 + 10 = 135.这大于127,因此加法溢出,最终结果为135 - 256 = - 121.