/+junk/vala-bit-field

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/vala-bit-field

« back to all changes in this revision

Viewing changes to src/bit_map.vala

  • Committer: Gustav Hartvigsson
  • Date: 2020-11-03 19:35:25 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20201103193525-tewczqy146ln4spx
* Made it able to be compiled as a library
* Added C test
* Added more tests to main.vala

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
  
17
17
  private static GLib.Tree<FieldInfo?, uint16> mask_cache;
18
18
  
19
 
  void init () {
 
19
  public void init () {
20
20
    list_of_types = new GLib.Tree<string, Type?> ((a, b) => {
21
21
      return (GLib.strcmp (a,b));
22
22
    });
26
26
    });
27
27
  }
28
28
  
29
 
  void deinit () {
 
29
  public void deinit () {
30
30
    list_of_types.foreach ((_key, _val) => {
31
31
      list_of_types.remove (_key);
32
32
      
34
34
    });
35
35
  }
36
36
  
37
 
  static bool add_type_v (string name, FieldInfo first_field, ...) {
 
37
  public static bool add_type_v (string name, FieldInfo first_field, ...) {
38
38
    var va = va_list ();
39
39
    
40
40
    GLib.List<FieldInfo?> lst = new GLib.List<FieldInfo?> ();
179
179
    uint8 start;
180
180
    uint8 end;
181
181
    uint8 length;
182
 
    GLib.pointer padding;
183
182
    
184
183
    public FieldInfo (int field_id, uint8 start, uint8 end, uint8 length) {
185
184
      this.field_id = field_id;
186
185
      this.start = start;
187
186
      this.end = end;
188
187
      this.length = length; 
189
 
      this.padding = null;
190
188
    }
191
189
    
192
190
    public int compare (FieldInfo other) {