From 130071bd6aa54eefada156ce79ce680f5bfd4391 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Fri, 30 Mar 2012 08:48:45 +0000 Subject: [PATCH] math: add a few comments. --- src/math/half.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/math/half.cpp b/src/math/half.cpp index d6fcf457..b4367bb2 100644 --- a/src/math/half.cpp +++ b/src/math/half.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2012 Sam Hocevar // This program is free software; you can redistribute it and/or // modify it under the terms of the Do What The Fuck You Want To // Public License, Version 2, as published by Sam Hocevar. See @@ -40,7 +40,8 @@ namespace lol /* Lookup table-based algorithm from “Fast Half Float Conversions” * by Jeroen van der Zijp, November 2008. No rounding is performed, - * and some NaN values may be incorrectly converted to Inf. */ + * and some NaN values may be incorrectly converted to Inf (because + * the lowest order bits in the mantissa are ignored). */ static inline uint16_t float_to_half_nobranch(uint32_t x) { static uint16_t const basetable[512] = @@ -157,6 +158,7 @@ static inline void float_to_half_vector(half *dst, float const *src) } #endif +/* We use this De Bruijn sequence to compute a branchless integer log2 */ static int const shifttable[32] = { 23, 14, 22, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 20, 0,