本文整理汇总了Golang中github.com/quarnster/util/encoding/binary.BinaryReader.Uint64方法的典型用法代码示例。如果您正苦于以下问题:Golang BinaryReader.Uint64方法的具体用法?Golang BinaryReader.Uint64怎么用?Golang BinaryReader.Uint64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/quarnster/util/encoding/binary.BinaryReader
的用法示例。
在下文中一共展示了BinaryReader.Uint64方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: executeLNE
func (s *state) executeLNE(op DW_LNE, length LEB128, br *binary.BinaryReader) error {
switch op {
case DW_LNE_end_sequence:
s.end_sequence = true
s.header.matrix = append(s.header.matrix, s.lineEntry)
s.reset()
case DW_LNE_set_address:
var err error
if length == 8 {
s.address, err = br.Uint64()
} else {
var v uint32
v, err = br.Uint32()
s.address = uint64(v)
}
s.op_index = 0
return err
case DW_LNE_define_file:
var fe fileEntry
if err := br.ReadInterface(&fe); err != nil {
return err
} else {
s.header.file_names = append(s.header.file_names, fe)
}
case DW_LNE_set_discriminator:
var arg LEB128
if err := br.ReadInterface(&arg); err != nil {
return err
}
s.discriminator = uint(arg)
default:
panic(fmt.Errorf("%s", op))
}
return nil
}
示例2: Read
func (ih *Header) Read(br *binary.BinaryReader) error {
if v, err := br.Uint32(); err != nil {
return err
} else if v != 0xffffffff {
ih.Length = uint64(v)
} else if v, err := br.Uint64(); err != nil {
return err
} else {
ih.is64 = true
ih.Length = v
}
var err error
ih.Version, err = br.Uint16()
return err
}
示例3: data
func (ie *InfoEntry) data(form DW_FORM, br binary.BinaryReader) interface{} {
if form == DW_FORM_ref_addr && ie.header.Version < 3 {
form = DW_FORM_addr
}
switch form {
case DW_FORM_flag_present:
return true
case DW_FORM_exprloc, DW_FORM_block:
var size LEB128
br.ReadInterface(&size)
r, _ := br.Read(int(size))
return r
case DW_FORM_block1:
size, _ := br.Uint8()
r, _ := br.Read(int(size))
return r
case DW_FORM_block2:
size, _ := br.Uint16()
r, _ := br.Read(int(size))
return r
case DW_FORM_block4:
size, _ := br.Uint32()
r, _ := br.Read(int(size))
return r
case DW_FORM_addr:
if ie.header.AddressSize == 8 {
v, _ := br.Uint64()
return v
} else {
v, _ := br.Uint32()
return uint64(v)
}
case DW_FORM_ref_addr, DW_FORM_strp, DW_FORM_sec_offset:
if ie.header.is64 {
v, _ := br.Uint64()
return v
} else {
v, _ := br.Uint32()
return uint64(v)
}
case DW_FORM_ref1, DW_FORM_flag, DW_FORM_data1:
v, _ := br.Uint8()
return uint64(v)
case DW_FORM_ref2, DW_FORM_data2:
v, _ := br.Uint16()
return uint64(v)
case DW_FORM_ref4, DW_FORM_data4:
v, _ := br.Uint32()
return uint64(v)
case DW_FORM_ref8, DW_FORM_data8:
v, _ := br.Uint64()
return v
case DW_FORM_sdata, DW_FORM_udata:
var r LEB128
br.ReadInterface(&r)
return uint64(r)
case DW_FORM_string:
buf := make([]byte, 4096)
for i := range buf {
if v, err := br.Uint8(); err != nil {
return err
} else if v == 0 {
buf = buf[:i]
break
} else {
buf[i] = byte(v)
}
}
return string(buf)
}
panic(fmt.Errorf("Unimplemented format: %s", form))
}