Added alignment masks
This commit is contained in:
parent
2ed56d5936
commit
b1fdb516d7
|
@ -15,7 +15,7 @@ func Encode(stream *Stream) (hex []byte, err error) {
|
|||
}
|
||||
|
||||
emitAddress := func(addr uint32) error {
|
||||
if (addr & 0xFFFF) == 0 {
|
||||
if (addr & (^ExtendedLinearAddressMask)) == 0 {
|
||||
emitRecord(Record{
|
||||
Code: RecordExtendedLinearAddress,
|
||||
Address: uint16(addr >> 16),
|
||||
|
@ -23,7 +23,7 @@ func Encode(stream *Stream) (hex []byte, err error) {
|
|||
})
|
||||
|
||||
return nil
|
||||
} else if (addr&0xFFF0000F) == 0 && (addr&0xF) == 0 {
|
||||
} else if (addr & (^RecordExtendedSegmentAddressMask)) == 0 {
|
||||
emitRecord(Record{
|
||||
Code: RecordExtendedSegmentAddress,
|
||||
Address: uint16(addr / 16),
|
||||
|
@ -40,8 +40,7 @@ func Encode(stream *Stream) (hex []byte, err error) {
|
|||
const sectionSize = 1 << 16
|
||||
|
||||
for _, r := range stream.Regions {
|
||||
baseAddress := r.Address
|
||||
if err = emitAddress(baseAddress); err != nil {
|
||||
if err = emitAddress(r.Address); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue