On 09/08/15 23:30, Matt Turner wrote:
On Sun, Aug 9, 2015 at 2:40 PM, Jose Fonseca <jfons...@vmware.com> wrote:
More portable.  Based on Roland Scheidegger's idea.

Tested with roundevent_test on Linux, MinGW, and MSVC.

https://bugs.freedesktop.org/show_bug.cgi?id=91591
---
  src/util/rounding.h | 15 +++++++++++----
  1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/util/rounding.h b/src/util/rounding.h
index 2d8f8d4..1116c31 100644
--- a/src/util/rounding.h
+++ b/src/util/rounding.h
@@ -28,6 +28,9 @@

  #include <math.h>
  #include <limits.h>
+#include <stdint.h>
+
+#include "macros.h" // STATIC_ASSERT

I don't think the STATIC_ASSERTs really add any safety,

My concern is the C-preprocessor logic. Personally I didn't have confidence it wouldn't overflow, giving false results.

But on 2nd thought, even it overflows, becuase we're using INT*_MAX (not UINT*_MAX) it should never cause false conditions to become true at worst it will trigger the #error cause.

So I'll remove the static asserts.

but they do
unfortunately cause us to include macros.h. :(

src/util/macros.h doesn't include any other headers, and I'd imagine to be included everywhere by now. I guess it doesn't matter anymore, but but it seems pretty hamrless include all things considered.

I'd personally remove them, but whatever you like.

Reviewed-by: Matt Turner <matts...@gmail.com>

Jose


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to