5#ifndef MODES_HARDWARE_COORDINATES_HPP
6#define MODES_HARDWARE_COORDINATES_HPP
11namespace lampda::modes::hardware::details {
14template<
size_t maxOverflowHeight,
typename _OutTy = std::array<u
int16_t, maxOverflowHeight + 1>>
15static constexpr _OutTy computeResidues(
float realExactWidth)
17 uint16_t floorWidth = floor(realExactWidth);
20 for (
size_t Y = 0; Y < results.size(); ++Y)
22 results[Y] = ((float)Y) * realExactWidth - ((float)Y * floorWidth);
29template<
size_t maxOverflowHeight,
typename _OutTy = etl::bitset<maxOverflowHeight + 1>>
30static constexpr _OutTy computeDeltaResidues(
float realExactWidth)
32 auto allResiduesY = computeResidues<maxOverflowHeight>(realExactWidth);
35 for (
size_t Y = 0; Y < results.size(); ++Y)
37 if (Y + 1 < allResiduesY.size())
38 results[Y] = (bool)(allResiduesY[Y] != allResiduesY[Y + 1]);
46template<
size_t maxOverflowHeight,
typename _OutTy = std::array<
int, maxOverflowHeight + 1>>
47static constexpr _OutTy computeExtraShiftResidues(
float realExactWidth)
49 auto allDeltaResiduesY = computeDeltaResidues<maxOverflowHeight>(realExactWidth);
53 for (
size_t Y = 0; Y < results.size(); ++Y)
56 if (Y + 1 >= allDeltaResiduesY.size())
58 if (allDeltaResiduesY[Y] && allDeltaResiduesY[Y + 1])
60 if (!allDeltaResiduesY[Y] && !allDeltaResiduesY[Y + 1])