node/lib/metasm/metasm/parse_c.rb
# updates the @fldoffset / @fldbitoffset hash storing the offset of members
updates the @fldoffset / @fldbitoffset hash storing the offset of members
updates the @fldoffset / @fldbitoffset hash storing the offset of members
def update_member_cache(parser)
			super(parser)
			@fldoffset = {}
			@fldbitoffset = {} if fldbitoffset
			al = align(parser)
			off = 0
			bit_off = 0
			isz = nil
			@members.each_with_index { |m, i|
				if bits and b = @bits[i]
					if not isz
						mal = [m.type.align(parser), al].min
						off = (off + mal - 1) / mal * mal
					end
					isz = parser.sizeof(m)
					if b == 0 or (bit_off > 0 and bit_off + b > 8*isz)
						bit_off = 0
						mal = [m.type.align(parser), al].min
						off = (off + isz + mal - 1) / mal * mal
					end
					if m.name
						@fldoffset[m.name] = off
						@fldbitoffset ||= {}
						@fldbitoffset[m.name] = [bit_off, b]
					end
					bit_off += b
				else
					if isz
						off += isz
						bit_off = 0
						isz = nil
					end
					mal = [m.type.align(parser), al].min
					off = (off + mal - 1) / mal * mal
					@fldoffset[m.name] = off if m.name
					off += parser.sizeof(m)
				end
			}
		end
def update_member_cache ( parser ) super ( parser ) @fldoffset = { } @fldbitoffset = { } if fldbitoffset al = align ( parser ) off = 0 bit_off = 0 isz = nil @members . each_with_index { | m , i | if bits and b = @bits [ i ] if not isz mal = [ m . type . align ( parser ) , al ] . min off = ( off + mal - 1 ) / mal * mal end isz = parser . sizeof ( m ) if b == 0 or ( bit_off > 0 and bit_off + b > 8 * isz ) bit_off = 0 mal = [ m . type . align ( parser ) , al ] . min off = ( off + isz + mal - 1 ) / mal * mal end if m . name @fldoffset [ m . name ] = off @fldbitoffset ||= { } @fldbitoffset [ m . name ] = [ bit_off , b ] end bit_off += b else if isz off += isz bit_off = 0 isz = nil end mal = [ m . type . align ( parser ) , al ] . min off = ( off + mal - 1 ) / mal * mal @fldoffset [ m . name ] = off if m . name off += parser . sizeof ( m ) end } end
updates the @fldoffset / @fldbitoffset hash storing the offset of members
updates the @fldoffset / @fldbitoffset hash storing the offset of members
parser