Fix sign compare issues
This commit is contained in:
@@ -21,7 +21,7 @@ void BinUtil::Read(T& v) {
|
|||||||
// Read data into buffer
|
// Read data into buffer
|
||||||
m_file.read(reinterpret_cast<char*>(buf.data()), sizeof(T));
|
m_file.read(reinterpret_cast<char*>(buf.data()), sizeof(T));
|
||||||
// Loop or in be reverse loop and chift the values
|
// Loop or in be reverse loop and chift the values
|
||||||
for (int i = 0; i < sizeof(T); i++) {
|
for (size_t i = 0; i < sizeof(T); i++) {
|
||||||
v |= static_cast<T>(buf[m_big ? sizeof(T) - 1 - i : i]) << (8 * i);
|
v |= static_cast<T>(buf[m_big ? sizeof(T) - 1 - i : i]) << (8 * i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ CTRFF_API void ctrff::RGB565toRGBA(std::vector<PD::u8> &img, PD::u16 *icon,
|
|||||||
img.resize(48 * 48 * 4);
|
img.resize(48 * 48 * 4);
|
||||||
img.clear();
|
img.clear();
|
||||||
}
|
}
|
||||||
for (PD::u32 y = 0; y < h; y++) {
|
for (int y = 0; y < h; y++) {
|
||||||
for (PD::u32 x = 0; x < w; x++) {
|
for (int x = 0; x < w; x++) {
|
||||||
auto idx = TileIndex(x, y, w);
|
auto idx = TileIndex(x, y, w);
|
||||||
PD::u32 pos = (y * w + x) * 4;
|
PD::u32 pos = (y * w + x) * 4;
|
||||||
MakePixelRGBA(img[pos + 0], img[pos + 1], img[pos + 2], img[pos + 3],
|
MakePixelRGBA(img[pos + 0], img[pos + 1], img[pos + 2], img[pos + 3],
|
||||||
@@ -45,8 +45,8 @@ CTRFF_API void ctrff::RGBA2RGB565(PD::u16 *out, const std::vector<PD::u8> &img,
|
|||||||
const int &w, const int &h) {
|
const int &w, const int &h) {
|
||||||
if (img.size() != size_t(w * h * 4)) return;
|
if (img.size() != size_t(w * h * 4)) return;
|
||||||
std::vector<PD::u8> px8 = img;
|
std::vector<PD::u8> px8 = img;
|
||||||
for (PD::u32 y = 0; y < h; y++) {
|
for (int y = 0; y < h; y++) {
|
||||||
for (PD::u32 x = 0; x < w; x++) {
|
for (int x = 0; x < w; x++) {
|
||||||
auto idx = TileIndex(x, y, w);
|
auto idx = TileIndex(x, y, w);
|
||||||
PD::u32 pos = (y * w + x) * 4;
|
PD::u32 pos = (y * w + x) * 4;
|
||||||
out[idx] = MakePixel565(img[pos], img[pos + 1], img[pos + 2]);
|
out[idx] = MakePixel565(img[pos], img[pos + 1], img[pos + 2]);
|
||||||
|
|||||||
Reference in New Issue
Block a user