hi,everyone:
我做优化时候,需要将一个有符号的32位 int 类型的数,做一个饱和操作,变成一个
无符号的8位的数。具体代码如下:
int var;
if(var>255) var = 255; //大于255 就置为255
else if(var < 0) var = 0; //小于0 就置为0
else var = var; // 0- 255 之间就保持不变
请问,有没有专门指令操作的,或者有比较快的方法?
Best Regards!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.