/[ascend]/trunk/base/generic/compiler/bit.h
ViewVC logotype

Diff of /trunk/base/generic/compiler/bit.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 11 by aw0a, Sat Nov 13 16:45:56 2004 UTC revision 33 by ben.allan, Sun Dec 26 20:06:01 2004 UTC
# Line 1  Line 1 
1  /*  /**<
2   *  Bit lists   *  Bit lists
3   *  by Tom Epperly   *  by Tom Epperly
4   *  Version: $Revision: 1.7 $   *  Version: $Revision: 1.7 $
# Line 32  Line 32 
32   *  Bits are numbered 0 .. (BLength(list)-1)   *  Bits are numbered 0 .. (BLength(list)-1)
33   */   */
34    
35  /*  /**<
36   *  When #including bit.h, make sure these files are #included first:   *  When #including bit.h, make sure these files are #included first:
37   *         #include "compiler.h"   *         #include "compiler.h"
38   */   */
# Line 47  struct BitList { Line 47  struct BitList {
47  };  };
48    
49  extern struct BitList *CreateBList(unsigned long);  extern struct BitList *CreateBList(unsigned long);
50  /*  /**<
51   *  struct BitList *CreateBList(len)   *  struct BitList *CreateBList(len)
52   *  unsigned long len;   *  unsigned long len;
53   *  Create a bit list with len elements.  The elements are all initialized to   *  Create a bit list with len elements.  The elements are all initialized to
# Line 55  extern struct BitList *CreateBList(unsig Line 55  extern struct BitList *CreateBList(unsig
55   */   */
56    
57  extern struct BitList *CreateFBList(unsigned long);  extern struct BitList *CreateFBList(unsigned long);
58  /*  /**<
59   *  struct BitList *CreateFBList(len)   *  struct BitList *CreateFBList(len)
60   *  unsigned long len;   *  unsigned long len;
61   *  Create a bit list with len elements.  The elements are all initialized to   *  Create a bit list with len elements.  The elements are all initialized to
# Line 63  extern struct BitList *CreateFBList(unsi Line 63  extern struct BitList *CreateFBList(unsi
63   */   */
64    
65  extern struct BitList *ExpandBList(struct BitList *,unsigned long);  extern struct BitList *ExpandBList(struct BitList *,unsigned long);
66  /*  /**<
67   *  struct BitList *ExpandBList(bl,len)   *  struct BitList *ExpandBList(bl,len)
68   *  struct BitList *bl;   *  struct BitList *bl;
69   *  unsigned long len;   *  unsigned long len;
# Line 74  extern struct BitList *ExpandBList(struc Line 74  extern struct BitList *ExpandBList(struc
74   */   */
75    
76  extern struct BitList *ExpandFBList(struct BitList *,unsigned long);  extern struct BitList *ExpandFBList(struct BitList *,unsigned long);
77  /*  /**<
78   *  struct BitList *ExpandBList(bl,len)   *  struct BitList *ExpandBList(bl,len)
79   *  struct BitList *bl;   *  struct BitList *bl;
80   *  unsigned long len;   *  unsigned long len;
# Line 85  extern struct BitList *ExpandFBList(stru Line 85  extern struct BitList *ExpandFBList(stru
85   */   */
86    
87  extern void DestroyBList(struct BitList *);  extern void DestroyBList(struct BitList *);
88  /*  /**<
89   *  void DestroyBList(bl)   *  void DestroyBList(bl)
90   *  struct BitList *bl;   *  struct BitList *bl;
91   *  Deallocate the memory for bl.   *  Deallocate the memory for bl.
92   */   */
93    
94  extern struct BitList *CopyBList(CONST struct BitList *);  extern struct BitList *CopyBList(CONST struct BitList *);
95  /*  /**<
96   *  struct BitList *CopyBList(bl)   *  struct BitList *CopyBList(bl)
97   *  struct BitList *bl;   *  struct BitList *bl;
98   *  Make a copy of bl and return it.  The length of the copy equals that of bl,   *  Make a copy of bl and return it.  The length of the copy equals that of bl,
# Line 101  extern struct BitList *CopyBList(CONST s Line 101  extern struct BitList *CopyBList(CONST s
101   */   */
102    
103  extern void OverwriteBList(CONST struct BitList *, struct BitList *);  extern void OverwriteBList(CONST struct BitList *, struct BitList *);
104  /*  /**<
105   *  struct BitList *OverwriteBList(src,target)   *  struct BitList *OverwriteBList(src,target)
106   *  struct BitList *src, *target;   *  struct BitList *src, *target;
107   *  src and target must be the same length or this function will not return.   *  src and target must be the same length or this function will not return.
# Line 111  extern void OverwriteBList(CONST struct Line 111  extern void OverwriteBList(CONST struct
111   */   */
112    
113  extern unsigned long BitListBytes(CONST struct BitList *);  extern unsigned long BitListBytes(CONST struct BitList *);
114  /*  /**<
115   *  unsigned long BitListBytes(bl)   *  unsigned long BitListBytes(bl)
116   *  struct BitList *bl;   *  struct BitList *bl;
117   *  unsigned long bytes;   *  unsigned long bytes;
# Line 119  extern unsigned long BitListBytes(CONST Line 119  extern unsigned long BitListBytes(CONST
119   */   */
120    
121  extern void SetBit(struct BitList *,unsigned long);  extern void SetBit(struct BitList *,unsigned long);
122  /*  /**<
123   *  void SetBit(bl,pos)   *  void SetBit(bl,pos)
124   *  struct BitList *bl;   *  struct BitList *bl;
125   *  unsigned long pos;   *  unsigned long pos;
# Line 127  extern void SetBit(struct BitList *,unsi Line 127  extern void SetBit(struct BitList *,unsi
127   */   */
128    
129  extern void ClearBit(struct BitList *,unsigned long);  extern void ClearBit(struct BitList *,unsigned long);
130  /*  /**<
131   *  void ClearBit(bl,pos)   *  void ClearBit(bl,pos)
132   *  struct BitList *bl;   *  struct BitList *bl;
133   *  unsigned long pos;   *  unsigned long pos;
# Line 135  extern void ClearBit(struct BitList *,un Line 135  extern void ClearBit(struct BitList *,un
135   */   */
136    
137  extern void CondSetBit(struct BitList *,unsigned long,int);  extern void CondSetBit(struct BitList *,unsigned long,int);
138  /*  /**<
139   *  void CondSetBit(bl,pos,cond)   *  void CondSetBit(bl,pos,cond)
140   *  struct BitList *bl;   *  struct BitList *bl;
141   *  unsigned long pos;   *  unsigned long pos;
# Line 144  extern void CondSetBit(struct BitList *, Line 144  extern void CondSetBit(struct BitList *,
144   */   */
145    
146  extern int ReadBit(CONST struct BitList *,unsigned long);  extern int ReadBit(CONST struct BitList *,unsigned long);
147  /*  /**<
148   *  int ReadBit(bl,pos)   *  int ReadBit(bl,pos)
149   *  struct BitList *bl;   *  struct BitList *bl;
150   *  unsigned long pos;   *  unsigned long pos;
# Line 152  extern int ReadBit(CONST struct BitList Line 152  extern int ReadBit(CONST struct BitList
152   */   */
153    
154  extern void IntersectBLists(struct BitList *,CONST struct BitList *);  extern void IntersectBLists(struct BitList *,CONST struct BitList *);
155  /*  /**<
156   *  void IntersectBList(bl1,bl2)   *  void IntersectBList(bl1,bl2)
157   *  struct BitList *bl1;   *  struct BitList *bl1;
158   *  const struct BitList *bl2;   *  const struct BitList *bl2;
# Line 161  extern void IntersectBLists(struct BitLi Line 161  extern void IntersectBLists(struct BitLi
161   */   */
162    
163  extern void UnionBLists(struct BitList *,CONST struct BitList *);  extern void UnionBLists(struct BitList *,CONST struct BitList *);
164  /*  /**<
165   *  void UnionBLists(bl1,bl2)   *  void UnionBLists(bl1,bl2)
166   *  struct BitList *bl1;   *  struct BitList *bl1;
167   *  const struct BitList *bl2;   *  const struct BitList *bl2;
# Line 175  extern void UnionBLists(struct BitList * Line 175  extern void UnionBLists(struct BitList *
175  #define BLength(bl) BLengthF(bl)  #define BLength(bl) BLengthF(bl)
176  #endif  #endif
177  extern unsigned long BLengthF(CONST struct BitList *);  extern unsigned long BLengthF(CONST struct BitList *);
178  /*  /**<
179   *  macro BLength(bl)   *  macro BLength(bl)
180   *  unsigned long BLengthF(bl)   *  unsigned long BLengthF(bl)
181   *  const struct BitList *bl;   *  const struct BitList *bl;
# Line 183  extern unsigned long BLengthF(CONST stru Line 183  extern unsigned long BLengthF(CONST stru
183   */   */
184    
185  extern int BitListEmpty(CONST struct BitList *);  extern int BitListEmpty(CONST struct BitList *);
186  /*  /**<
187   *  int BitListEmpty(bl)   *  int BitListEmpty(bl)
188   *  const struct BitList *bl;   *  const struct BitList *bl;
189   *  Return a true value if bl is empty; otherwise, it returns a false value.   *  Return a true value if bl is empty; otherwise, it returns a false value.
# Line 191  extern int BitListEmpty(CONST struct Bit Line 191  extern int BitListEmpty(CONST struct Bit
191    
192    
193  extern int CompBList(struct BitList *,struct BitList *);  extern int CompBList(struct BitList *,struct BitList *);
194  /*  /**<
195   *  int CompBList(bl,b2)   *  int CompBList(bl,b2)
196   *  const struct BitList *bl;   *  const struct BitList *bl;
197   *  const struct BitList *b2;   *  const struct BitList *b2;
# Line 199  extern int CompBList(struct BitList *,st Line 199  extern int CompBList(struct BitList *,st
199   */   */
200    
201  extern unsigned long FirstNonZeroBit(CONST struct BitList *);  extern unsigned long FirstNonZeroBit(CONST struct BitList *);
202  /*  /**<
203   *  unsigned long FirstNonZeroBit(bl)   *  unsigned long FirstNonZeroBit(bl)
204   *  const struct BitList *bl;   *  const struct BitList *bl;
205   *  Return the first non-zero bit.  If it is unable to find a non-zero   *  Return the first non-zero bit.  If it is unable to find a non-zero
206   *  it will return a number greater than BLength(bl).   *  it will return a number greater than BLength(bl).
207   */   */
208  #endif /* __BIT_H_SEEN__ */  #endif /**< __BIT_H_SEEN__ */

Legend:
Removed from v.11  
changed lines
  Added in v.33

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22