Optimal Int to Float Function - Printable Version +- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com) +-- Forum: Hacks/Modding (https://mariokartwii.com/forumdisplay.php?fid=14) +--- Forum: Coding & Hacking General Discussion (https://mariokartwii.com/forumdisplay.php?fid=23) +--- Thread: Optimal Int to Float Function (/showthread.php?tid=1665) |
Optimal Int to Float Function - JoshuaMK - 11-10-2020 This code is the most optimal way to convert an integer of any value to float, supporting negative values and being self contained: Code: # Args: r3 = Integer to convert to float NOTE: This is meant to be called as a function RE: Optimal Int to Float Function - Vega - 11-10-2020 How does this differ from way back when Salmon01 posted a version of this he found in the PPC Compiler Writer's Guide? https://mkwii.com/showthread.php?tid=1252 When taking what Salmon provided and changing it to be self-contained, I ended up with this (untested) --- Code: #Prologue Also what's the purpose of the lis r31, 0x5980 instruction? Floats are by far my weakest point of my ASM knowledge. |