본문 바로가기

전체 글

동적할당 대신 배열을 사용해 시간 줄이기(feat. 코딩테스트) 코등테스트 문제를 풀 시에, 동적할당 대신 배열을 사용함으로써 시간을 save할 수 있는 방법. int arr_idx = 0; typedef struct Node { int value; } Node; #define MAX_SIZE1000 Node a[MAX_SIZE]; Node *myAlloc(void) { return &a[arr_idx++]; } int main(void) { ... } 위와 같이 필요한 순간에 마다 malloc() 함수를 통해 공간을 할당받는 것이 아니라, 필요한 만큼의 size를 미리 잡아두고(compile time에) 필요할 때마다 myAlloc() 함수를 통해 미리 잡아둔 메모리 공간의 주소를 얻어오는 방식으로 시간을 save할 수 있다. 매 case가 시작될 때마다 'arr_.. 더보기
특별한 용도의 ARM register (Special Purpose Register) 아래 글에서 ARM register 중 특별한 용도로 사용되는 register가 있다고 소개했다. 2021.05.05 - [Embedded SW] - ARM7 레지스터와 모드(ARM7 register and mode) ARM7 레지스터와 모드(ARM7 register and mode) [ARM7 Mode] ARM7 Core 에는 아래와 같이 7가지 mode가 존재한다. num mode abbreviations description 1 User USR Usual ARM program execution state, and is used for executing most application programs 2 S.. computersource.tistory.com ARM register 중 특별한 용도로 사.. 더보기
ARM7 레지스터와 모드(ARM7 register and mode) [ARM7 Mode] ARM7 Core 에는 아래와 같이 7가지 mode가 존재한다. num mode abbreviations description 1 User USR Usual ARM program execution state, and is used for executing most application programs 2 System SYS Privileged user mode for the operating system (Run privileged operating system tasks) 3 FIQ FIQ When fast interrupt is raised 4 IRQ IRQ When normal interrupt is raised 5 Supervisor SVC A protected mode fo.. 더보기