5#ifndef MODES_HARDWARE_COORDINATES_HPP
6#define MODES_HARDWARE_COORDINATES_HPP
10namespace lampda::modes::hardware::details {
13template<
size_t maxOverflowHeight,
typename _OutTy = std::array<u
int16_t, maxOverflowHeight + 1>>
14static constexpr _OutTy computeResidues(
float realExactWidth)
16 uint16_t floorWidth = floor(realExactWidth);
19 for (
size_t Y = 0; Y < results.size(); ++Y)
21 results[Y] = ((float)Y) * realExactWidth - ((float)Y * floorWidth);
28template<
size_t maxOverflowHeight,
typename _OutTy = std::array<
bool, maxOverflowHeight + 1>>
29static constexpr _OutTy computeDeltaResidues(
float realExactWidth)
31 auto allResiduesY = computeResidues<maxOverflowHeight>(realExactWidth);
34 for (
size_t Y = 0; Y < results.size(); ++Y)
36 if (Y + 1 < allResiduesY.size())
37 results[Y] = (bool)(allResiduesY[Y] != allResiduesY[Y + 1]);
45template<
size_t maxOverflowHeight,
typename _OutTy = std::array<
int, maxOverflowHeight + 1>>
46static constexpr _OutTy computeExtraShiftResidues(
float realExactWidth)
48 auto allDeltaResiduesY = computeDeltaResidues<maxOverflowHeight>(realExactWidth);
52 for (
size_t Y = 0; Y < results.size(); ++Y)
55 if (Y + 1 >= allDeltaResiduesY.size())
57 if (allDeltaResiduesY[Y] && allDeltaResiduesY[Y + 1])
59 if (!allDeltaResiduesY[Y] && !allDeltaResiduesY[Y + 1])