基本上,我很难使执行时间比实际时间要短,并且要减少时钟周期和内存大小。有谁知道我该怎么做吗?代码工作正常,我只想稍作更改。
编写了有效的代码,但不想弄乱代码,但也不知道要进行哪些更改。
; Calculation of a factorial value using a simple loop
; set up the exception addresses
THUMB
AREA RESET, CODE, READONLY
EXPORT __Vectors
EXPORT Reset_Handler
__Vectors
DCD 0x00180000 ; top of the stack
DCD Reset_Handler ; reset vector - where the program starts
AREA 2a_Code, CODE, READONLY
Reset_Handler
ENTRY
start
MOV r1,#0 ; count the number of multiplications performed
MOV r2,#3 ; the final value in the factorial calculation
MOV r3,#1 ; the factorial result will be stored …Run Code Online (Sandbox Code Playgroud)