Macro - Bit Operation
·
【Programming】/C
#define Macro_Set_Bit(dest, position) ((dest) |= ((unsigned)0x1>(position)) & 0x1)#define Macro_Check_Bit_Clear(dest, position) (!((((unsigned)dest)>>(position)) & 0x1))#define Macro_Extract_Area(dest, bits, position) ((((unsigned)dest)>>(position)) & (bits))
Writing Efficient C and C Code Optimization
·
【Programming】/C
원문: Code Project번역: Joinc
비트 필드의 인식과 코딩의 자유로움에 대하여
·
【Programming】/C
가끔은 말리는 경향이 있는.....
restrict type qualifier
·
【Programming】/C
*출처: http://superkkt.com/291 void *memcpy(void *restrict s1, const void *restrict s2, size_t n);위 선언에서 restrict라는 구문이 있다. 표준 함수들의 선언에 보면 아주 많이 등장을 하는데, 이것은 C99 표준에 추가된 내용으로서 함수 안에서 각각의 인자로 전달된 포인터들이 서로 독립적인 영역을 가르키고 있다는것을 보장해 준다. 위에서 예로 든 memcpy 함수에 전달되는 인자는 서로 중복되는 영역을 포인팅해서는 안된다.이것을 사용하는 이유는 최적화와 관련이 있다. 바로 포인터가 최적화를 방해하는 요소이기 때문이다. 포인터는 어떠한 곳을 가르키고 있을지 모르기 때문에 컴파일러가 임의로 최적화를 하면 프로그래머가 의도하지 않은..
define으로 해결하는 C 자료구조
·
【Programming】/C
http://resin.csoft.net/cgi-bin/man.cgi?section=3&topic=queuehttp://resin.csoft.net/cgi-bin/man.cgi?section=3&topic=tree
함수포인터의 재정의: typedef와 함수포인터
·
【Programming】/C
함수포인터를 어떤 포인터 변수로서 활용하고 싶을 때 typedef를 활용하면 매우 편리한다.typedef LRESULT(CALLBACK *WNDPROC)(HWND,UINT,WPARAM,LPARAM);* 사용예LRESULT CALLBACK winproc1(HWND,UINT,WPARAM,LPARAM) { };...WNDPROC winprocPtr = winproc1;...