From: Giovanni Mascellani Subject: Re: [PATCH vkd3d] vkd3d-shader/hlsl: Handle constant value operations on a different file. Message-Id: <7dcfde36-bffb-1ab1-d1c4-f4c36577d4ab@codeweavers.com> Date: Wed, 5 Jan 2022 09:38:52 +0100 In-Reply-To: References: <3a4f11c7-f56d-1690-1860-a3085b18467d@codeweavers.com> <20220103145733.104047-1-fcasas@codeweavers.com> Hi, On 04/01/22 17:59, Francisco Casas wrote: > Noted. The only problem with (+), (*), and (-), I can think of is > signed integer overflow. I think so. Notice that for these three operations (and unary negation) you can just treat signed numbers as unsigned and everything will be fine, at least on the platforms we target. For floating point operations the result can unfortunately depend on the currently set floating point environment (so in theory we'd have to check what native compiler does and set the environment accordingly), but I guess we can ignore this problem for the moment. I don't think those operations should cause floating point exceptions, with the possible exception of signaling NaNs, which I don't really know how they work in practice. This is something that can be deferred to later too, I think. > I am not sure yet if implicit castings in C may result in undefined > behaviors, I must check. I don't think so. Implicit casting is not different from explicit casting in what it does, only in when it is allowed, I think. Giovanni.