ld/src/ld/debugline.c
/* Read a SLEB128 into a 64-bit word.  Return 0 on overflow or error
   (which is not very helpful).  On overflow, skip past the rest of
   the SLEB128.  For negative numbers, this actually overflows when
   under -2^62, but since this is used for line numbers that ought to
   be OK...  */
Read a SLEB128 into a 64-bit word.  Return 0 on overflow or error
(which is not very helpful).  On overflow, skip past the rest of
the SLEB128.  For negative numbers, this actually overflows when
under -2^62, but since this is used for line numbers that ought to
be OK
Read a SLEB128 into a 64 - bit word . Return 0 on overflow or error ( which is not very helpful ) . On overflow skip past the rest of the SLEB128 . For negative numbers this actually overflows when under - 2^62 but since this is used for line numbers that ought to be OK
static int64_t
read_sleb128 (struct line_reader_data * leb)
{
  const uint8_t * start_pos = leb->cpos;
  uint64_t v = read_uleb128 (leb);
  uint64_t signbit;
  if (v >= 1ull << 63)
    return 0;
  if (leb->cpos - start_pos > 9)
    return v;
  signbit = 1ull << ((leb->cpos - start_pos) * 7 - 1);
  return v | -(v & signbit);
}
static int64_t read_sleb128 ( struct line_reader_data * leb ) { const uint8_t * start_pos = leb -> cpos ; uint64_t v = read_uleb128 ( leb ) ; uint64_t signbit ; if ( v >= 1ull << 63 ) return 0 ; if ( leb -> cpos - start_pos > 9 ) return v ; signbit = 1ull << ( ( leb -> cpos - start_pos ) * 7 - 1 ) ; return v | - ( v & signbit ) ; }
Read a SLEB128 into a 64-bit word.
Read a SLEB128 into a 64 - bit word .