~romain-bouqueau-pro/abstract/master

« back to all changes in this revision

Viewing changes to src/model.d

  • Committer: rbouqueau
  • Date: 2014-12-15 11:57:51 UTC
  • Revision ID: romain.bouqueau.pro@gmail.com-20141215115751-ah4eh7w0qeyczzbk
introduce bits in blocks

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
2
 * @file model.d
3
 
 * @author Sebastien Alaiwan
 
3
 * @author Sebastien Alaiwan - Romain Bouqueau
4
4
 * @date 2014-10-08
5
5
 */
6
6
 
141
141
 
142
142
class FieldBlock
143
143
{
144
 
  int iSizeInBytes;
 
144
  int iSizeInBits;
145
145
  string sType;
146
146
  string sName;
147
147
  int iArrayLength;
152
152
              string sComment)
153
153
{
154
154
  auto r = new FieldBlock;
155
 
  r.iSizeInBytes = iSizeInBytes;
 
155
  r.iSizeInBits = iSizeInBytes * 8;
 
156
  r.sType = sType;
 
157
  r.sName = sName;
 
158
  r.iArrayLength = iArrayLength;
 
159
  r.sComment = sComment;
 
160
  return new Block(r);
 
161
}
 
162
 
 
163
Block mkFieldBits(int iSizeInBits, string sType, string sName, int iArrayLength,
 
164
                  string sComment)
 
165
{
 
166
  auto r = new FieldBlock;
 
167
  r.iSizeInBits = iSizeInBits;
156
168
  r.sType = sType;
157
169
  r.sName = sName;
158
170
  r.iArrayLength = iArrayLength;