func calculateLBA(rlba [6]uint8, is48Bit bool) int64 {
	// Pad two bytes at the end to parse as uint64
	b := []byte{
		rlba[0],
		rlba[1],
		rlba[2],
		rlba[3],
		rlba[4],
		rlba[5],
		0,
		0,
	}
	lba := binary.LittleEndian.Uint64(b)

	// Mask off high bits to limit size to either 48 bit or 28 bit,
	// depending on is48Bit's value.
	if is48Bit {
		// 48-bit
		lba &= 0x0000ffffffffffff
	} else {
		// 28-bit
		lba &= 0x0fffffff
	}

	return int64(lba)
}
func calculateLBA(rlba [6]uint8, is48Bit bool) int64 {
	
	b := []byte{
		rlba[0],
		rlba[1],
		rlba[2],
		rlba[3],
		rlba[4],
		rlba[5],
		0,
		0,
	}
	lba := binary.LittleEndian.Uint64(b)

	
	
	if is48Bit {
		
		lba &= 0x0000ffffffffffff
	} else {
		
		lba &= 0x0fffffff
	}

	return int64(lba)
}
func calculateLBA ( rlba [ 6 ] uint8 , is48Bit bool ) int64 { // Pad two bytes at the end to parse as uint64 b := [ ] byte { rlba [ 0 ] , rlba [ 1 ] , rlba [ 2 ] , rlba [ 3 ] , rlba [ 4 ] , rlba [ 5 ] , 0 , 0 , } lba := binary . LittleEndian . Uint64 ( b ) // Mask off high bits to limit size to either 48 bit or 28 bit, // depending on is48Bit's value. if is48Bit { // 48-bit lba &= 0x0000ffffffffffff } else { // 28-bit lba &= 0x0fffffff } return int64 ( lba ) }
// calculateLBA calculates a logical block address from the LBA array
// and 48-bit flags from an ATAArg.
calculateLBA calculates a logical block address from the LBA array and 48 - bit flags from an ATAArg .