7fd59977 |
1 | // File: IntPatch_PrmPrmIntersection_T3Bits.cxx |
2 | // Created: Thu Dec 16 16:34:03 1999 |
3 | // Author: Atelier CAS2000 |
4 | // Copyright: OPEN CASCADE 1999 |
5 | |
6 | #include <IntPatch_PrmPrmIntersection_T3Bits.ixx> |
7 | |
8 | IntPatch_PrmPrmIntersection_T3Bits::IntPatch_PrmPrmIntersection_T3Bits(const Standard_Integer size) |
9 | { |
10 | //-- ex: size=4 -> 4**3 = 64 bits -> 2 mots 32bits |
11 | Standard_Integer nb = (size*size*size)>>5; |
12 | Isize = nb; |
13 | p = new Standard_Integer [nb]; |
14 | do { ((Standard_Integer *) p)[--nb]=0; } while(nb); |
15 | } |
16 | |
17 | void IntPatch_PrmPrmIntersection_T3Bits::Destroy() |
18 | { |
19 | if(p) { delete[] ((Standard_Integer*)p); p=NULL; } |
20 | } |
21 | |
22 | void IntPatch_PrmPrmIntersection_T3Bits::ResetAnd() |
23 | { |
24 | //ind = 0; |
25 | } |
26 | |
27 | Standard_Integer IntPatch_PrmPrmIntersection_T3Bits::And(IntPatch_PrmPrmIntersection_T3Bits& Oth, |
28 | Standard_Integer& indice) |
29 | { |
30 | int k=indice>>5; |
7fd59977 |
31 | while(k<Isize) |
32 | { |
33 | Standard_Integer r=((Standard_Integer *) p)[k] & ((Standard_Integer *) Oth.p)[k]; |
34 | if(r) |
35 | { |
36 | unsigned long int c=0; |
37 | do |
38 | { |
39 | if(r&1) |
40 | { |
41 | const Standard_Integer op = (k<<5)|(c); |
42 | Raz(op); |
43 | Oth.Raz(op); |
44 | indice = op; |
45 | return(1); |
46 | } |
47 | c++; |
48 | r>>=1; |
49 | } |
50 | while(c<32); |
51 | } |
52 | k++; |
53 | } |
54 | return(0); |
55 | } |