// first line to copy and paste crawler [authorized by Winways]
typedef unsigned char BYTE#define assgin (A, ...) Assginarr (A, # #__VA_ARGS__)
voidAssginarr (unsignedChar*_des, ...) { inti =0; Va_list apptr; Va_start (Apptr, _des); //int* C = _des + 1; //int* D = & (_des[1]); //Auto e = sizeof (_des[0]) * (_des[0]-1); //memcpy (_des + 1, apptr, sizeof (_des[0]) * (_des[0]-1)); while(true) { intIvalue = Va_arg (Apptr,int); if(Ivalue = =-1) Break; _des[i++] =Ivalue; }; Va_end (apptr);}
BYTE aaa[6] = {};
The main point is that the test data is automatically assigned rather than initialized.
Assgin (AAA, 0x04,0x14,0x24,0x34,0x15,0x06,-1);
The middle is another way. Only applies to 4-byte long data types because variable parameters default storage space 4 bytes Fixed even if the incoming byte is also cast
and _des + 1 in the actual assembly code in the array according to
Base + offset * sizeof (type) to calculate the next address even if it is passed in C + + only the first site of the array, but the result of the array and pointer + 1 is to be transformed that the pointer address operation is calculated according to base + variable address
There is a factor of 1 2 4 8 for Base address address addressing in byte (unsigned char) WORD (unsigned short) int Long that's the truth.
This factor is stored in a 8-bit sib.
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Specify coefficients |
Specify the variable address register |
Specify Base Address register |
Although the efficiency of memcpy is higher, this method is not feasible for non-4 byte length types
Easier to use for initializing array or array assignments note to specify Terminator-1
[Kit Kat Kinky] Test array assignment