efi: fix loader build.

This commit is contained in:
Jérôme Duval
2018-06-03 18:14:32 +02:00
parent 379d232693
commit 8088f452ff
2 changed files with 16 additions and 3 deletions
+4 -3
View File
@@ -84,7 +84,7 @@ static video_mode*
closest_video_mode(uint32 width, uint32 height, uint32 depth) closest_video_mode(uint32 width, uint32 height, uint32 depth)
{ {
video_mode *bestMode = NULL; video_mode *bestMode = NULL;
uint32 bestDiff = 0; int64 bestDiff = 0;
video_mode *mode = NULL; video_mode *mode = NULL;
while ((mode = (video_mode*)list_get_next_item(&sModeList, mode)) != NULL) { while ((mode = (video_mode*)list_get_next_item(&sModeList, mode)) != NULL) {
@@ -94,8 +94,9 @@ closest_video_mode(uint32 width, uint32 height, uint32 depth)
continue; continue;
} }
uint32 diff = 2 * abs(mode->width - width) + abs(mode->height - height) int64 diff = 2 * abs((int64)mode->width - width)
+ abs(mode->bits_per_pixel - depth); + abs((int64)mode->height - height)
+ abs((int64)mode->bits_per_pixel - depth);
if (bestMode == NULL || bestDiff > diff) { if (bestMode == NULL || bestDiff > diff) {
bestMode = mode; bestMode = mode;
@@ -15,6 +15,15 @@
namespace { namespace {
// __m128i resolves to a type with an attribute, which can't get into the
// template signature, resulting in a warning. Nonetheless the code is what we
// expect, so we silent the warning.
#pragma GCC diagnostic push
#if defined __GNUC__ && __GNUC__ >= 6
#pragma GCC diagnostic ignored "-Wignored-attributes"
#endif
template<template<size_t N> class Generator, unsigned N, unsigned ...Index> template<template<size_t N> class Generator, unsigned N, unsigned ...Index>
struct GenerateTable : GenerateTable<Generator, N - 1, N - 1, Index...> { struct GenerateTable : GenerateTable<Generator, N - 1, N - 1, Index...> {
}; };
@@ -32,6 +41,9 @@ struct GenerateTable<Generator, 0, Index...>
}; };
#pragma GCC diagnostic pop
static inline void memcpy_repmovs(uint8_t* destination, const uint8_t* source, static inline void memcpy_repmovs(uint8_t* destination, const uint8_t* source,
size_t length) size_t length)
{ {