我正在尝试在 VC++ 2010 中创建一些内联程序集,以将 RGB 字节缓冲区解压缩到 RGBA 字节缓冲区中,这就是我想出的:
但我得到了错误
1>c:\users\tom\documents\visual studio 2010\projects\source\engine\image_load.c(28): error C2414: illegal number of operands
1>c:\users\tom\documents\visual studio 2010\projects\source\engine\image_load.c(28): error C2400: inline assembler syntax error in 'first operand'; found ':'
1>c:\users\tom\documents\visual studio 2010\projects\source\engine\image_load.c(29): error C2400: inline assembler syntax error in 'opcode'; found ':'
1>c:\users\tom\documents\visual studio 2010\projects\source\engine\image_load.c(29): warning C4405: 'MOV' : identifier is reserved word
1>c:\users\tom\documents\visual studio 2010\projects\source\engine\image_load.c(30): error C2415: improper operand type
1>c:\users\tom\documents\visual studio 2010\projects\source\engine\image_load.c(31): error C2415: improper operand type
1>c:\users\tom\documents\visual studio 2010\projects\source\engine\image_load.c(37): warning C4405: 'loop' : identifier is reserved word
1>c:\users\tom\documents\visual studio 2010\projects\source\engine\image_load.c(71): warning C4018: '<' : signed/unsigned mismatch
我不确定它有什么问题,这是我的代码:
void RGBtoRGBA (byte *rgba, const byte *rgb, int pixelCount) {
__asm {
MOV EDX, pixelCount
MOV EBX, rgba
MOV ECX, rgb
loop:
MOV [EBX], ECX
MOV [EBX+1], [ECX+1]
MOV [EBX+2], [ECX+2]
MOV [EBX+3], 255
ADD EBX, 4
ADD ECX, 3
DEC EDX
JNZ loop
}
}
原谅我,我是组装新手:(