diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f58c217..38fe29ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,18 @@ * Constants with heap start and segment start are now generated properly. +* Signed multiplication support for `sbyte` and `signed16`. + +* Heavily experimental `typeof` builtin. + * 6502: Fixed sbyte to word promotions in certain contexts. +* 8080: Fixed compilation of sign extension of `sbyte` values into the BC register pair. + +* Fixed negative constant folding. + +* Fixed optimizations around macro invocations. + * Optimized word shifts for between 7 and 12 bits. * Allowed new lines after `=`. diff --git a/docs/lang/operators.md b/docs/lang/operators.md index f3b499c8..fe7ccc88 100644 --- a/docs/lang/operators.md +++ b/docs/lang/operators.md @@ -95,7 +95,7 @@ TODO `constant word + byte` `word + word` (zpreg) -* `*`: multiplication; the size of the result is the same as the size of the arguments +* `*`: multiplication (signed or unsigned); the size of the result is the same as the size of the largest of the arguments `byte * constant byte` `constant byte * byte` `constant word * constant word` @@ -313,6 +313,14 @@ some enum → `word` and the result is a constant of either `byte` or `word` type, depending on the actual value. In case of aligned types, this returns the aligned size. +* `typeof`: a word constant that identifies the type of the argument; the argument can be an expression or a type. +The argument is never evaluated. +**Warnings:** + * **This is a highly experimental feature.** + * The exact values may change in any future version of the compiler. Only compare one `typeof` to another `typeof`. + * There is no guarantee that different types will have different values of `typeof`. Indeed, it's even easy to see that a Millfork program can have more than 65536 types – and values of `typeof` can clash even before that. + * In certain circumstances, pointer types and function pointer types may have different `typeof` values even if they're essentially the same. + * `call`: calls a function via a pointer; the first argument is the pointer to the function; the second argument, if present, is the argument to the called function.