def bit_pack_encode(
            self, item: MajorItem,
            reference: "MajorItemState") -> Iterator[Tuple[int, int]]:
        db = default_database.resource_database_for(item.game)
        if item.progression:
            main_index = item.progression[0]
        else:
            main_index = item.ammo_index[0]
        main_item = db.get_item(main_index)

        # original location
        if item.original_index is not None:
            yield from bitpacking.encode_bool(
                self.include_copy_in_original_location)

        # num shuffled
        yield from bitpacking.encode_int_with_limits(self.num_shuffled_pickups,
                                                     DEFAULT_MAXIMUM_SHUFFLED)

        # starting item
        if main_item.max_capacity > 1:
            yield from bitpacking.encode_int_with_limits(
                self.num_included_in_starting_items,
                (2, main_item.max_capacity + 1))
        else:
            yield self.num_included_in_starting_items, main_item.max_capacity + 1

        # priority
        yield from bitpacking.BitPackFloat(
            self.priority).bit_pack_encode(PRIORITY_LIMITS)

        # ammo index
        assert len(self.included_ammo) == len(item.ammo_index)
        if self.included_ammo:
            custom_ammo = self.included_ammo != reference.included_ammo
            yield from bitpacking.encode_bool(custom_ammo)
            if custom_ammo:
                all_equal = len(set(self.included_ammo)) == 1
                if len(item.ammo_index) > 1:
                    yield from bitpacking.encode_bool(all_equal)

                for ammo_index, ammo in zip(item.ammo_index,
                                            self.included_ammo):
                    yield ammo, db.get_item(ammo_index).max_capacity + 1
                    if all_equal:
                        break
def test_round_trip_float(value: float, metadata: dict):
    result = bitpacking.round_trip(bitpacking.BitPackFloat(value), metadata)
    assert result == value