public IntegerValue sizeof(Context ctxt) { IntegerValue size = new IntegerValue(0); IntegerValue eight = new IntegerValue(8); for (int i = 0; i < fields.size(); i++) { Field fi = (Field) fields.elementAt(i); /* TODO: try { StdIntegerType b = StdIntegerType.getBuiltinType(fi.getFieldType()); if (b instanceof BitFieldType) { size = size.add(new IntegerValue(((BitFieldType) b) .getLength())); continue; } } catch (ClassCastException _) { } */ size = size.add(fi.sizeof(ctxt).multiply(eight)); } return size.divide(eight); }
public IntegerValue bitsizeof(Context ctxt) { IntegerValue size = new IntegerValue(0); for (int i = 0; i < fields.size(); i++) { Field fi = (Field) fields.elementAt(i); /* * TODO: * try * { * StdIntegerType b = StdIntegerType.getBuiltinType(fi.getFieldType()); * if (b instanceof BitFieldType) * { * size = size.add(new IntegerValue(((BitFieldType) b).getLength())); * continue; * } * } * catch (ClassCastException _) * { * } */ size = size.add(fi.bitsizeof(ctxt)); } return size; }