Re: C: Arduino : Přesun pole bytů do proměnné unsigned long

Jan Waclawek konfera na efton.sk
Středa Listopad 8 19:38:38 CET 2023


>Spíš možná SHIFTovat a ORovat.

  b2 = rx[3] | (rx[4] << 8) | ((uint32_t)rx[5] << 16) | ((uint32_t)rx[6] <<
24);
  c = b2;


  39 0048 E091 0000 		lds r30,rx+3
  40 004c C091 0000 		lds r28,rx+4
  41 0050 D0E0      		ldi r29,0
  42 0052 8091 0000 		lds r24,rx+5
  43 0056 C82E      		mov r12,r24
  44 0058 D12C      		mov r13,__zero_reg__
  45 005a F12C      		mov r15,__zero_reg__
  46 005c E12C      		mov r14,__zero_reg__
  47 005e 4091 0000 		lds r20,rx+6
  48 0062 50E0      		ldi r21,0
  49 0064 70E0      		ldi r23,0
  50 0066 60E0      		ldi r22,0
  51 0068 0091 0000 		lds r16,rx+3
  52 006c 1091 0000 		lds r17,rx+3+1
  53 0070 012E      		mov __tmp_reg__,r17
  54 0072 000C      		lsl r0
  55 0074 220B      		sbc r18,r18
  56 0076 330B      		sbc r19,r19
  57 0078 D601      		movw r26,r12
  58 007a 9927      		clr r25
  59 007c 8827      		clr r24
  60 007e 802B      		or r24,r16
  61 0080 912B      		or r25,r17
  62 0082 A22B      		or r26,r18
  63 0084 B32B      		or r27,r19
  64 0086 342F      		mov r19,r20
  65 0088 2227      		clr r18
  66 008a 1127      		clr r17
  67 008c 0027      		clr r16
  68 008e 802B      		or r24,r16
  69 0090 912B      		or r25,r17
  70 0092 A22B      		or r26,r18
  71 0094 B32B      		or r27,r19
  72 0096 8093 0000 		sts b2,r24
  73 009a 9093 0000 		sts b2+1,r25
  74 009e A093 0000 		sts b2+2,r26
  75 00a2 B093 0000 		sts b2+3,r27
  76 00a6 8093 0000 		sts c,r24
  77 00aa 9093 0000 		sts c+1,r25
  78 00ae A093 0000 		sts c+2,r26
  79 00b2 B093 0000 		sts c+3,r27

wek





Další informace o konferenci Hw-list