标签: objective-c char int hex
我要转换
int x = 4进入unsigned char y = 0x04
int x = 4
unsigned char y = 0x04
int x = 0进入unsigned char y = 0x00
int x = 0
unsigned char y = 0x00
int x = -4进入unsigned char y = 0xFC
int x = -4
unsigned char y = 0xFC
int x = -8进入unsigned char y = 0xF8
int x = -8
unsigned char y = 0xF8
依此类推,直到-20到0xEC。
有谁知道一个聪明的方法吗?