在调试中发现,字符串默认存储是一个英文字符需要2个字节,第一个字节为0,第二个字节才是对应的ASCII码。但是我需要存储大量的字符串,有没有办法充分利用存储空间?
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.
在调试中发现,字符串默认存储是一个英文字符需要2个字节,第一个字节为0,第二个字节才是对应的ASCII码。但是我需要存储大量的字符串,有没有办法充分利用存储空间?
F28X默认最小寻址是16位。如果要访问8位的数据,可以参考文档TMS320C28x C/C++ Language Implementation User's Guide (SPRU514) in Section 6.3 called Data Types.
There are compiler instrinsics __byte() and __mov_byte() to access data in increments of 8-bits。
int __byte( int *array, unsigned int byte_index );
int a;
int b1;
int c;
a = 0x1234;
b1 = __byte(&a,0); // b = 0x0034
c = __byte(&a,1); // c = 0x0012
__byte(&a,0) = 0x55; // a = 0x1255
__byte(&a,1) = 0x77; // a = 0x7755
Eric