블로그 이미지
안녕1999

카테고리

전체 (3067)
자바스크립트 (20)
안드로이드 (14)
WebGL (4)
변비 (17)
정치,경제 (35)
C언어,ARM (162)
컴퓨터(PC, Note Book, 윈.. (41)
전자회로, PCB (27)
유머,안웃긴,GIF,동영상 (118)
국부론60 (71)
모듈(PCB) (3)
건강 (2)
FreeCAD (25)
PADS (43)
퇴직,퇴사,구직,취업 활동 (3)
C# (86)
엑셀 (8)
워드 (0)
LabView (6)
레고 (30)
FPGA (0)
Total
Today
Yesterday

달력

« » 2025.7
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

공지사항

최근에 올라온 글

sBITARRAY

카테고리 없음 / 2019. 2. 16. 23:30

sBITARRAY.cpp

sBITARRAY.h


번호 순서, 번호별 존재여부등을 체크하는데 필요.


#ifndef sBITARRAY_H

#define sBITARRAY_H

#define MAX_sBITARRAY (1024*1024)


#ifndef DWORD

#define DWORD unsigned long

#endif

typedef struct

{

DWORD a[MAX_sBITARRAY/32];

int cnt1;

}sBITARRAY;

#define sBITARRAY_inc_cnt1(p) (p)->cnt1++;DEBUG_sBITARRAY_view(p);

#define sBITARRAY_dec_cnt1(p) if((p)->cnt1>0){(p)->cnt1--;DEBUG_sBITARRAY_view(p);}


void sBITARRAY_init(sBITARRAY *pA);

int sBITARRAY_gbi(sBITARRAY *pA,int i);

int sBITARRAY_sbi(sBITARRAY *pA,int i);//ret=changed

int sBITARRAY_cbi(sBITARRAY *pA,int i);//ret=changed

int sBITARRAY_set_bit_i(sBITARRAY *pA,int i,int v);//ret=changed

#define sBITARRAY_get_cnt(pA) ((pA)->cnt1)


DWORD *sBITARRAY_get_ptr(sBITARRAY *pA,int i,int *ibit);

int sBITARRAY_get_1_cnt(sBITARRAY *pA);

int sBITARRAY_get_0_cnt(sBITARRAY *pA);

int sBITARRAY_get_first_index(sBITARRAY *pA,int i,int v);//i부터 검색하여, 첫번째 나오는 v값의 인덱스




#ifdef _DEBUG

#include "sBITARRAY.h"

class test_sBITARRAY

{

public:

test_sBITARRAY()

{

sBITARRAY a;int i;

sBITARRAY_init(&a);

for(i=0;i<MAX_sBITARRAY+1;i++)

{

sBITARRAY_sbi(&a,i);

}


for(i=0;i<MAX_sBITARRAY+1;i++)

{

sBITARRAY_cbi(&a,i);

}


sBITARRAY_sbi(&a,0);

sBITARRAY_sbi(&a,8);

sBITARRAY_sbi(&a,9);

sBITARRAY_sbi(&a,10);


sBITARRAY_sbi(&a,30);

sBITARRAY_sbi(&a,38);

sBITARRAY_sbi(&a,39);

sBITARRAY_sbi(&a,40);


sBITARRAY_cbi(&a,30);

sBITARRAY_cbi(&a,38);

sBITARRAY_cbi(&a,39);

sBITARRAY_cbi(&a,40);


sBITARRAY_cbi(&a,0);

sBITARRAY_cbi(&a,8);

sBITARRAY_cbi(&a,9);

sBITARRAY_cbi(&a,10);

}

};

#endif

#endif


Posted by 안녕1999
, |

최근에 달린 댓글

글 보관함