Vector API "FizzBuzz", how-to without "REM" or "URSHIFT" operator?
Remi Forax
forax at univ-mlv.fr
Tue Jul 4 20:44:07 UTC 2023
> From: "Gavin Ray" <ray.gavin97 at gmail.com>
> To: "panama-dev" <panama-dev at openjdk.org>
> Sent: Tuesday, July 4, 2023 9:54:06 PM
> Subject: Vector API "FizzBuzz", how-to without "REM" or "URSHIFT" operator?
> I got curious about writing a simple FizzBuzz program with the Vector API as a
> learning exercise
> I realized that there appears to be no operator supporting modulo/remainder.
> Is it possible to emulate modulo with a composition of other operators?
You don't need it,
For representing Fizz, Buzz or FizzBuzz, the idea is to use -1, -2 and -3 so every values is an int.
Then you do not need a modulo because you can compute the first 15 values, and then adds 15 to the next 15 values that are not Fizz, Buzz or FizzBuzz (so that are not a negative value).
> Thank you =)
regards,
Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230704/72ea6708/attachment.htm>
More information about the panama-dev
mailing list