risc5emu-fp.h (1190B)
1 // Copyright © 2014 Peter De Wachter 2 // 3 // Permission to use, copy, modify, and/or distribute this software for 4 // any purpose with or without fee is hereby granted, provided that the 5 // above copyright notice and this permission notice appear in all 6 // copies. 7 // 8 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 9 // WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 10 // WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 11 // AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 12 // DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 13 // PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 14 // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 // PERFORMANCE OF THIS SOFTWARE. 16 17 // based on src/risc-fp.h from git@github.com:pdewacht/oberon-risc-emu.git 18 19 #ifndef RISC_FP_H 20 #define RISC_FP_H 21 22 #include <stdint.h> 23 #include <stdbool.h> 24 25 uint32_t fp_add(uint32_t x, uint32_t y, bool u, bool v); 26 uint32_t fp_mul(uint32_t x, uint32_t y); 27 uint32_t fp_div(uint32_t x, uint32_t y); 28 29 struct idiv { uint32_t quot, rem; }; 30 struct idiv idiv(uint32_t x, uint32_t y, bool signed_div); 31 32 #endif // RISC_FP_H