mirror of
https://github.com/projectPiki/pikmin2.git
synced 2024-12-02 18:36:39 +00:00
decompile s_ldexp.c
added isfinite macro to math.h and include guards to fdlibm.h
This commit is contained in:
parent
bc5f8c8c1c
commit
c53b454bc0
@ -1,157 +0,0 @@
|
||||
.include "macros.inc"
|
||||
.section .sdata2, "a" # 0x80516360 - 0x80520E40
|
||||
.balign 0x8
|
||||
.global lbl_805175B0
|
||||
lbl_805175B0:
|
||||
.4byte 0x00000000
|
||||
.4byte 0x00000000
|
||||
.global lbl_805175B8
|
||||
lbl_805175B8:
|
||||
.4byte 0x43500000
|
||||
.4byte 0x00000000
|
||||
.global lbl_805175C0
|
||||
lbl_805175C0:
|
||||
.4byte 0x01A56E1F
|
||||
.4byte 0xC2F8F359
|
||||
.global lbl_805175C8
|
||||
lbl_805175C8:
|
||||
.4byte 0x7E37E43C
|
||||
.4byte 0x8800759C
|
||||
.global lbl_805175D0
|
||||
lbl_805175D0:
|
||||
.4byte 0x3C900000
|
||||
.4byte 0x00000000
|
||||
|
||||
.section .text, "ax" # 0x800056C0 - 0x80472F00
|
||||
.global ldexp
|
||||
ldexp:
|
||||
/* 800CF55C 000CC49C 94 21 FF E0 */ stwu r1, -0x20(r1)
|
||||
/* 800CF560 000CC4A0 7C 08 02 A6 */ mflr r0
|
||||
/* 800CF564 000CC4A4 D8 21 00 10 */ stfd f1, 0x10(r1)
|
||||
/* 800CF568 000CC4A8 80 A1 00 10 */ lwz r5, 0x10(r1)
|
||||
/* 800CF56C 000CC4AC 90 01 00 24 */ stw r0, 0x24(r1)
|
||||
/* 800CF570 000CC4B0 3C 00 7F F0 */ lis r0, 0x7ff0
|
||||
/* 800CF574 000CC4B4 54 A4 00 56 */ rlwinm r4, r5, 0, 1, 0xb
|
||||
/* 800CF578 000CC4B8 7C 04 00 00 */ cmpw r4, r0
|
||||
/* 800CF57C 000CC4BC D8 21 00 08 */ stfd f1, 8(r1)
|
||||
/* 800CF580 000CC4C0 41 82 00 14 */ beq lbl_800CF594
|
||||
/* 800CF584 000CC4C4 40 80 00 58 */ bge lbl_800CF5DC
|
||||
/* 800CF588 000CC4C8 2C 04 00 00 */ cmpwi r4, 0
|
||||
/* 800CF58C 000CC4CC 41 82 00 2C */ beq lbl_800CF5B8
|
||||
/* 800CF590 000CC4D0 48 00 00 4C */ b lbl_800CF5DC
|
||||
lbl_800CF594:
|
||||
/* 800CF594 000CC4D4 54 A0 03 3F */ clrlwi. r0, r5, 0xc
|
||||
/* 800CF598 000CC4D8 40 82 00 10 */ bne lbl_800CF5A8
|
||||
/* 800CF59C 000CC4DC 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 800CF5A0 000CC4E0 2C 00 00 00 */ cmpwi r0, 0
|
||||
/* 800CF5A4 000CC4E4 41 82 00 0C */ beq lbl_800CF5B0
|
||||
lbl_800CF5A8:
|
||||
/* 800CF5A8 000CC4E8 38 00 00 01 */ li r0, 1
|
||||
/* 800CF5AC 000CC4EC 48 00 00 34 */ b lbl_800CF5E0
|
||||
lbl_800CF5B0:
|
||||
/* 800CF5B0 000CC4F0 38 00 00 02 */ li r0, 2
|
||||
/* 800CF5B4 000CC4F4 48 00 00 2C */ b lbl_800CF5E0
|
||||
lbl_800CF5B8:
|
||||
/* 800CF5B8 000CC4F8 54 A0 03 3F */ clrlwi. r0, r5, 0xc
|
||||
/* 800CF5BC 000CC4FC 40 82 00 10 */ bne lbl_800CF5CC
|
||||
/* 800CF5C0 000CC500 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 800CF5C4 000CC504 2C 00 00 00 */ cmpwi r0, 0
|
||||
/* 800CF5C8 000CC508 41 82 00 0C */ beq lbl_800CF5D4
|
||||
lbl_800CF5CC:
|
||||
/* 800CF5CC 000CC50C 38 00 00 05 */ li r0, 5
|
||||
/* 800CF5D0 000CC510 48 00 00 10 */ b lbl_800CF5E0
|
||||
lbl_800CF5D4:
|
||||
/* 800CF5D4 000CC514 38 00 00 03 */ li r0, 3
|
||||
/* 800CF5D8 000CC518 48 00 00 08 */ b lbl_800CF5E0
|
||||
lbl_800CF5DC:
|
||||
/* 800CF5DC 000CC51C 38 00 00 04 */ li r0, 4
|
||||
lbl_800CF5E0:
|
||||
/* 800CF5E0 000CC520 2C 00 00 02 */ cmpwi r0, 2
|
||||
/* 800CF5E4 000CC524 40 81 01 2C */ ble lbl_800CF710
|
||||
/* 800CF5E8 000CC528 C8 02 92 50 */ lfd f0, lbl_805175B0@sda21(r2)
|
||||
/* 800CF5EC 000CC52C FC 00 08 00 */ fcmpu cr0, f0, f1
|
||||
/* 800CF5F0 000CC530 40 82 00 08 */ bne lbl_800CF5F8
|
||||
/* 800CF5F4 000CC534 48 00 01 1C */ b lbl_800CF710
|
||||
lbl_800CF5F8:
|
||||
/* 800CF5F8 000CC538 80 A1 00 08 */ lwz r5, 8(r1)
|
||||
/* 800CF5FC 000CC53C 80 C1 00 0C */ lwz r6, 0xc(r1)
|
||||
/* 800CF600 000CC540 54 A4 65 7F */ rlwinm. r4, r5, 0xc, 0x15, 0x1f
|
||||
/* 800CF604 000CC544 40 82 00 4C */ bne lbl_800CF650
|
||||
/* 800CF608 000CC548 54 A0 00 7E */ clrlwi r0, r5, 1
|
||||
/* 800CF60C 000CC54C 7C C0 03 79 */ or. r0, r6, r0
|
||||
/* 800CF610 000CC550 40 82 00 08 */ bne lbl_800CF618
|
||||
/* 800CF614 000CC554 48 00 00 FC */ b lbl_800CF710
|
||||
lbl_800CF618:
|
||||
/* 800CF618 000CC558 C8 21 00 08 */ lfd f1, 8(r1)
|
||||
/* 800CF61C 000CC55C 3C 80 FF FF */ lis r4, 0xFFFF3CB0@ha
|
||||
/* 800CF620 000CC560 C8 02 92 58 */ lfd f0, lbl_805175B8@sda21(r2)
|
||||
/* 800CF624 000CC564 38 04 3C B0 */ addi r0, r4, 0xFFFF3CB0@l
|
||||
/* 800CF628 000CC568 7C 03 00 00 */ cmpw r3, r0
|
||||
/* 800CF62C 000CC56C FC 21 00 32 */ fmul f1, f1, f0
|
||||
/* 800CF630 000CC570 D8 21 00 08 */ stfd f1, 8(r1)
|
||||
/* 800CF634 000CC574 80 A1 00 08 */ lwz r5, 8(r1)
|
||||
/* 800CF638 000CC578 54 A4 65 7E */ rlwinm r4, r5, 0xc, 0x15, 0x1f
|
||||
/* 800CF63C 000CC57C 38 84 FF CA */ addi r4, r4, -54
|
||||
/* 800CF640 000CC580 40 80 00 10 */ bge lbl_800CF650
|
||||
/* 800CF644 000CC584 C8 02 92 60 */ lfd f0, lbl_805175C0@sda21(r2)
|
||||
/* 800CF648 000CC588 FC 20 00 72 */ fmul f1, f0, f1
|
||||
/* 800CF64C 000CC58C 48 00 00 C4 */ b lbl_800CF710
|
||||
lbl_800CF650:
|
||||
/* 800CF650 000CC590 2C 04 07 FF */ cmpwi r4, 0x7ff
|
||||
/* 800CF654 000CC594 40 82 00 10 */ bne lbl_800CF664
|
||||
/* 800CF658 000CC598 C8 01 00 08 */ lfd f0, 8(r1)
|
||||
/* 800CF65C 000CC59C FC 20 00 2A */ fadd f1, f0, f0
|
||||
/* 800CF660 000CC5A0 48 00 00 B0 */ b lbl_800CF710
|
||||
lbl_800CF664:
|
||||
/* 800CF664 000CC5A4 7C 84 1A 14 */ add r4, r4, r3
|
||||
/* 800CF668 000CC5A8 2C 04 07 FE */ cmpwi r4, 0x7fe
|
||||
/* 800CF66C 000CC5AC 40 81 00 1C */ ble lbl_800CF688
|
||||
/* 800CF670 000CC5B0 C8 22 92 68 */ lfd f1, lbl_805175C8@sda21(r2)
|
||||
/* 800CF674 000CC5B4 C8 41 00 08 */ lfd f2, 8(r1)
|
||||
/* 800CF678 000CC5B8 4B FF FC 15 */ bl copysign
|
||||
/* 800CF67C 000CC5BC C8 02 92 68 */ lfd f0, lbl_805175C8@sda21(r2)
|
||||
/* 800CF680 000CC5C0 FC 20 00 72 */ fmul f1, f0, f1
|
||||
/* 800CF684 000CC5C4 48 00 00 8C */ b lbl_800CF710
|
||||
lbl_800CF688:
|
||||
/* 800CF688 000CC5C8 2C 04 00 00 */ cmpwi r4, 0
|
||||
/* 800CF68C 000CC5CC 40 81 00 1C */ ble lbl_800CF6A8
|
||||
/* 800CF690 000CC5D0 54 A3 03 00 */ rlwinm r3, r5, 0, 0xc, 0
|
||||
/* 800CF694 000CC5D4 54 80 A0 16 */ slwi r0, r4, 0x14
|
||||
/* 800CF698 000CC5D8 7C 60 03 78 */ or r0, r3, r0
|
||||
/* 800CF69C 000CC5DC 90 01 00 08 */ stw r0, 8(r1)
|
||||
/* 800CF6A0 000CC5E0 C8 21 00 08 */ lfd f1, 8(r1)
|
||||
/* 800CF6A4 000CC5E4 48 00 00 6C */ b lbl_800CF710
|
||||
lbl_800CF6A8:
|
||||
/* 800CF6A8 000CC5E8 2C 04 FF CA */ cmpwi r4, -54
|
||||
/* 800CF6AC 000CC5EC 41 81 00 44 */ bgt lbl_800CF6F0
|
||||
/* 800CF6B0 000CC5F0 3C 80 00 01 */ lis r4, 0x0000C350@ha
|
||||
/* 800CF6B4 000CC5F4 38 04 C3 50 */ addi r0, r4, 0x0000C350@l
|
||||
/* 800CF6B8 000CC5F8 7C 03 00 00 */ cmpw r3, r0
|
||||
/* 800CF6BC 000CC5FC 40 81 00 1C */ ble lbl_800CF6D8
|
||||
/* 800CF6C0 000CC600 C8 22 92 68 */ lfd f1, lbl_805175C8@sda21(r2)
|
||||
/* 800CF6C4 000CC604 C8 41 00 08 */ lfd f2, 8(r1)
|
||||
/* 800CF6C8 000CC608 4B FF FB C5 */ bl copysign
|
||||
/* 800CF6CC 000CC60C C8 02 92 68 */ lfd f0, lbl_805175C8@sda21(r2)
|
||||
/* 800CF6D0 000CC610 FC 20 00 72 */ fmul f1, f0, f1
|
||||
/* 800CF6D4 000CC614 48 00 00 3C */ b lbl_800CF710
|
||||
lbl_800CF6D8:
|
||||
/* 800CF6D8 000CC618 C8 22 92 60 */ lfd f1, lbl_805175C0@sda21(r2)
|
||||
/* 800CF6DC 000CC61C C8 41 00 08 */ lfd f2, 8(r1)
|
||||
/* 800CF6E0 000CC620 4B FF FB AD */ bl copysign
|
||||
/* 800CF6E4 000CC624 C8 02 92 60 */ lfd f0, lbl_805175C0@sda21(r2)
|
||||
/* 800CF6E8 000CC628 FC 20 00 72 */ fmul f1, f0, f1
|
||||
/* 800CF6EC 000CC62C 48 00 00 24 */ b lbl_800CF710
|
||||
lbl_800CF6F0:
|
||||
/* 800CF6F0 000CC630 38 04 00 36 */ addi r0, r4, 0x36
|
||||
/* 800CF6F4 000CC634 54 A3 03 00 */ rlwinm r3, r5, 0, 0xc, 0
|
||||
/* 800CF6F8 000CC638 54 00 A0 16 */ slwi r0, r0, 0x14
|
||||
/* 800CF6FC 000CC63C C8 22 92 70 */ lfd f1, lbl_805175D0@sda21(r2)
|
||||
/* 800CF700 000CC640 7C 60 03 78 */ or r0, r3, r0
|
||||
/* 800CF704 000CC644 90 01 00 08 */ stw r0, 8(r1)
|
||||
/* 800CF708 000CC648 C8 01 00 08 */ lfd f0, 8(r1)
|
||||
/* 800CF70C 000CC64C FC 21 00 32 */ fmul f1, f1, f0
|
||||
lbl_800CF710:
|
||||
/* 800CF710 000CC650 80 01 00 24 */ lwz r0, 0x24(r1)
|
||||
/* 800CF714 000CC654 7C 08 03 A6 */ mtlr r0
|
||||
/* 800CF718 000CC658 38 21 00 20 */ addi r1, r1, 0x20
|
||||
/* 800CF71C 000CC65C 4E 80 00 20 */ blr
|
@ -2,6 +2,7 @@
|
||||
#define _DOLPHIN_MATH_H
|
||||
|
||||
#include "types.h"
|
||||
#include "fdlibm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -36,4 +37,51 @@ double atan2(double, double);
|
||||
};
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
inline int __fpclassifyf(float x)
|
||||
{
|
||||
switch ((*(s32*)&x) & 0x7f800000) {
|
||||
case 0x7f800000: {
|
||||
if ((*(s32*)&x) & 0x007fffff)
|
||||
return 1;
|
||||
else
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
if ((*(s32*)&x) & 0x007fffff)
|
||||
return 5;
|
||||
else
|
||||
return 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
inline int __fpclassifyd(double x)
|
||||
{
|
||||
switch (__HI(x) & 0x7ff00000) {
|
||||
case 0x7ff00000: {
|
||||
if ((__HI(x) & 0x000fffff) || (__LO(x) & 0xffffffff))
|
||||
return 1;
|
||||
else
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
if ((__HI(x) & 0x000fffff) || (__LO(x) & 0xffffffff))
|
||||
return 5;
|
||||
else
|
||||
return 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
#define fpclassify(x) \
|
||||
((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) \
|
||||
: __fpclassifyd((double)(x)))
|
||||
|
||||
#define isfinite(x) ((fpclassify(x) > 2))
|
||||
|
||||
#endif
|
||||
|
@ -1,3 +1,5 @@
|
||||
#ifndef _FDLIBM_H
|
||||
#define _FDLIBM_H
|
||||
|
||||
/* @(#)fdlibm.h 1.5 04/04/22 */
|
||||
/*
|
||||
@ -222,3 +224,5 @@ extern int __kernel_rem_pio2 __P((double*, double*, int, int, int, const int*));
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
#endif
|
||||
|
@ -322,7 +322,7 @@ DOLPHIN:=\
|
||||
$(BUILD_DIR)/src/Dolphin/s_cos.o\
|
||||
$(BUILD_DIR)/src/Dolphin/s_floor.o\
|
||||
$(BUILD_DIR)/src/Dolphin/s_frexp.o\
|
||||
$(BUILD_DIR)/asm/Dolphin/s_ldexp.o\
|
||||
$(BUILD_DIR)/src/Dolphin/s_ldexp.o\
|
||||
$(BUILD_DIR)/src/Dolphin/s_modf.o\
|
||||
$(BUILD_DIR)/src/Dolphin/s_sin.o\
|
||||
$(BUILD_DIR)/src/Dolphin/s_tan.o\
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#ifndef _No_Floating_Point
|
||||
/* @(#)s_ldexp.c 1.2 95/01/04 */
|
||||
/* $Id: s_ldexp.c,v 1.3.14.1 2002/01/31 15:24:14 ceciliar Exp $ */
|
||||
@ -13,9 +12,8 @@
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#include "dolphin/fdlibm.h"
|
||||
//#include <errno.h>
|
||||
#include <math.h> /* for isfinite macro */
|
||||
#include "fdlibm.h"
|
||||
#include "Dolphin/math.h" /* for isfinite macro */
|
||||
static const double
|
||||
|
||||
two54
|
||||
@ -25,7 +23,7 @@ static const double
|
||||
|
||||
double ldexp(double x, int n)
|
||||
{
|
||||
_INT32 k, hx, lx; /*- cc 020130 -*/
|
||||
s32 k, hx, lx; /*- cc 020130 -*/
|
||||
if (!isfinite(x) || x == 0.0)
|
||||
return x;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user