Hi,
On 03/01/22 15:57, Francisco Casas wrote:
On constant folding, first switch on the op type, handling each operation using a function defined on hlsl_constant_ops.c.
Creating a new file makes sense to me, but while you're doing it it also makes sense to copy there the whole implementation of fold_constants(), doesn't it? It logically related to hlsl_constant_ops.c, and it also spares you adding a lot of functions to the header file (also, if you do that you probably have only one function to add to the header, fold_constants() itself, and you can put it in hlsl.h instead of creating a new file).
While I don't have any specific objection against it, is there a particular reason for inverting the switch on the type and on the operation?
Each of these operations switches on the data type, if needed.
As I just said on the other thread (where I replied before noticing this one), watch out for undefined behavior that some operations entail.
I am not sure if I should be on the copyright notice of the new files.
What you did looks fine to me. It doesn't look like we're too strict about code attribution anyway: it seems that the first developer to create a file leaves their name on it, but nobody ever adds their name to a file they change. At least, I am not aware of that.
Giovanni.