[gdal-dev] Using bitwise & with muparser VRT expressions
Even Rouault
even.rouault at spatialys.com
Thu Dec 4 07:49:56 PST 2025
Le 04/12/2025 à 16:45, Hugh Graham a écrit :
> Many thanks to all - this is very helpful.
>
> Dan, I'll explore some of these other options you mention. In this new
> PR, is it the case that by switching to using theLLVM dialect these
> operators will automatically be recognised? I suppose if this is the
> case then explicitly adding the operator might not strictly be
> necessary...
Yes, with the LLVM dialect, if your input bands are of integer type and
you specify an output integer type, bitwise and will be done in the
integer domain.
>
> Also, I appreciate the clarification that values are always
> converted to float during the arithmetic, I agree, Javier, that in
> this case a bitwise operation is a bit strange...
When using muparser, yes they are converted to double, since its
"official" API only exposes that data type. But if the absolute value of
integer values is below 1 << 53, they are perfectly represented as a
double, so this is generally not much of an issue.
--
http://www.spatialys.com
My software is free, but my time generally not.
More information about the gdal-dev
mailing list