I wrote a simple version. In the attached patch constants are collected by calling the `reduce-constants' function from the `source-transform-transitive' and `source-transform-intransitive' functions (which is used by `define-source-transform' forms for transitive and intransitive arithmetic functions) form compiler/srctran.lisp.
It works fine for building process and tests, but when I see this comment:
;;; Only safely applicable for exact numbers. For floating-point
;;; x, one would have to first show that neither x or y are signed
;;; 0s, and that x isn't an SNaN.
for (+ X 0) folder - it is safely to collect all type of numbers in compile time?
I wrote a simple version. In the attached patch constants are collected by calling the `reduce-constants' function from the `source- transform- transitive' and `source- transform- intransitive' functions (which is used by `define- source- transform' forms for transitive and intransitive arithmetic functions) form compiler/ srctran. lisp.
It works fine for building process and tests, but when I see this comment:
;;; Only safely applicable for exact numbers. For floating-point
;;; x, one would have to first show that neither x or y are signed
;;; 0s, and that x isn't an SNaN.
for (+ X 0) folder - it is safely to collect all type of numbers in compile time?