[Mesa-dev] [PATCH 6/6] mesa: replace binary constants with hexadecimal constants

Andres Gomez agomez at igalia.com
Wed Aug 1 22:00:44 UTC 2018


On Wed, 2018-08-01 at 16:43 -0400, Ilia Mirkin wrote:
> On Wed, Aug 1, 2018 at 2:53 PM, Andres Gomez <agomez at igalia.com> wrote:
> > The binary constant notation "0b" is a GCC extension. Instead, we use
> > hexadecimal notation to fix the MSVC 2013 build:
> > 
> > Compiling src\mesa\main\texcompress_astc.cpp ...
> > texcompress_astc.cpp
> > src\mesa\main\texcompress_astc.cpp(111) : error C2059: syntax error : 'bad suffix on number'
> > 
> > ...
> > 
> > src\mesa\main\texcompress_astc.cpp(1007) : fatal error C1003: error count exceeds 100; stopping compilation
> > scons: *** [build\windows-x86-debug\mesa\main\texcompress_astc.obj] Error 2
> > scons: building terminated because of errors.
> > 
> > Fixes: 38ab39f6501 ("mesa: add ASTC 2D LDR decoder")
> > Cc: Marek Olšák <marek.olsak at amd.com>
> > Cc: Brian Paul <brianp at vmware.com>
> > Cc: Roland Scheidegger <sroland at vmware.com>
> > Cc: Mike Lothian <mike at fireburn.co.uk>
> > Cc: Gert Wollny <gert.wollny at collabora.com>
> > Cc: Dieter Nützel <Dieter at nuetzel-hh.de>
> > Signed-off-by: Andres Gomez <agomez at igalia.com>
> > ---
> >  src/mesa/main/texcompress_astc.cpp | 116 ++++++++++++++---------------
> >  1 file changed, 58 insertions(+), 58 deletions(-)
> > 
> > diff --git a/src/mesa/main/texcompress_astc.cpp b/src/mesa/main/texcompress_astc.cpp
> > index 996e8ea28d6..ae2733ea333 100644
> > --- a/src/mesa/main/texcompress_astc.cpp
> > +++ b/src/mesa/main/texcompress_astc.cpp
> > @@ -1345,30 +1345,30 @@ void Block::unquantise_colour_endpoints()
> >              D = v >> 1;
> >              break;
> >           case 2:
> > -            B = (v & 0b10) ? 0b100010110 : 0b000000000;
> > +            B = (v & 0x2) ? 0x116 : 0x000;
> >              C = 93;
> >              D = v >> 2;
> >              break;
> >           case 3:
> > -            t = ((v >> 1) & 0b11);
> > +            t = ((v >> 1) & 0x3);
> >              B = t | (t << 2) | (t << 7);
> >              C = 44;
> >              D = v >> 3;
> >              break;
> >           case 4:
> > -            t = ((v >> 1) & 0b111);
> > +            t = ((v >> 1) & 0x5);
> 
> 0x7

Pffffffweeee! ... good catch, Ilia.

Thanks!

-- 
Br,

Andres


More information about the mesa-dev mailing list