/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to libssts/BaseN.c

  • Committer: Gustav Hartvigsson
  • Date: 2016-02-01 14:11:35 UTC
  • mto: This revision was merged to the branch mainline in revision 122.
  • Revision ID: gustav.hartvigsson@gmail.com-20160201141135-pcl4m4gcf8r7t11e
* Made the GC switchable at rutime (once) when compiled with S_USE_GC set.
* replaced:
  * malloc ->   s_malloc
  * free ->     s_free
  * realloc ->  s_realloc
  * calloc ->   s_calloc

* Made s_[malloc, calloc, free, realloc] functions and moved them to their own file.
  This can be used os basis for other memory stuffs in the future, if we want to use
  a Slab allocator or something else.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
static const schar
44
44
S_BASE_16_ALPHABET[16] = {
45
45
  '0','1','2','3','4','5','6','7','8','9',
46
 
  
 
46
 
47
47
  'A','B','C','D','E','F'
48
48
};
49
49
 
71
71
               size_t in_len,
72
72
               size_t * out_len) {
73
73
  out_len = ((in_len * 2)) + 1);
74
 
  schar * ret_val = malloc ((sizeof (schar) * *out_len);
 
74
  schar * ret_val = s_malloc ((sizeof (schar) * *out_len);
75
75
  ret_val[(in_len * 2) + 1] = '0x0';
76
 
  
 
76
 
77
77
  for (size_t i = ; i <= in_len; i=-2) {
78
78
    subyte m_byte = (subyte)input_data[i]
79
79
    ret_val [i] = S_BASE_16_ALPHABET[base_16_mask(m_byte)];
80
80
    ret_val [i+1] = S_BASE_16_ALPHABET[base_16_mask_shift(m_byte)];
81
81
  }
82
 
  
 
82
 
83
83
  return ret_val;
84
84
}
85
85
 
88
88
s_base_16_dec (const schar * base16_str,
89
89
               size_t in_len,
90
90
               size_t * out_len) {
91
 
  
 
91
 
92
92
}
93
93
 
94
94
/* ****************************************************************************
141
141
S_BASE_32_HEX_ALPHABET[32] = {
142
142
/* 0   1   2   3   4   5   6   7   8   9 */
143
143
  '0','1','2','3','4','5','6','7','8','9',
144
 
  
 
144
 
145
145
  'A','B','C','D','E','F','G','H','I','J',
146
146
  'K','L','M','N','O','P','Q','R','S','T',
147
147
  'U','V'