/+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-06-06 21:34:04 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20200606213404-54jtvoi8pf6a792g
* added main repo to README

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
 
  public void init () {
 
19
  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
 
  public void deinit () {
 
29
  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
 
  public static bool add_type_v (string name, FieldInfo first_field, ...) {
 
37
  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?> ();
47
47
    
48
48
    FieldInfo[] lst2 = new FieldInfo[lst.length ()];
49
49
    
50
 
    for (uint i = 0; i < lst.length (); i++) {
51
 
      lst2[i] = lst.nth_data (i);
52
 
    }
53
 
   
54
 
    return add_type (name, lst2);
 
50
    add_type (name, lst2);
 
51
    
 
52
    return false;
55
53
  }
56
54
  
57
55
  /**
179
177
    uint8 start;
180
178
    uint8 end;
181
179
    uint8 length;
 
180
    GLib.pointer padding;
182
181
    
183
182
    public FieldInfo (int field_id, uint8 start, uint8 end, uint8 length) {
184
183
      this.field_id = field_id;
185
184
      this.start = start;
186
185
      this.end = end;
187
186
      this.length = length; 
 
187
      this.padding = null;
188
188
    }
189
189
    
190
190
    public int compare (FieldInfo other) {
222
222
    }
223
223
    
224
224
    [CCode (cname = "bit_field_field_info_compare")]
225
 
    public static extern int static_compare (FieldInfo a, FieldInfo b);
226
 
    
 
225
    public static extern int static_campare (FieldInfo a, FieldInfo b);
227
226
    
228
227
    
229
228
    public bool overlap (FieldInfo other) {
231
230
    }
232
231
    
233
232
    [CCode (cname = "bit_field_field_info_overlap")]
234
 
    public static extern bool static_overlap (FieldInfo a, FieldInfo b);
 
233
    public static extern int static_overlap (FieldInfo a, FieldInfo b);
235
234
    
236
235
    
237
236
    public string to_string () {