Difference between revisions of "BCDtoInternal"

From WikiPrizm
Jump to navigationJump to search
 
Line 22: Line 22:
 
   unsigned short exponent:12;
 
   unsigned short exponent:12;
 
   unsigned short mantissa0:4;
 
   unsigned short mantissa0:4;
   TBCDbyte mantissa[7];
+
   BCDbyte mantissa[7];
 
   char flags;
 
   char flags;
 
   short info;
 
   short info;

Latest revision as of 14:35, 31 July 2014


Synopsis

Header: fxcg/misc.h
Syscall index: 0x0160
Function signature: int BCDtoInternal(struct BCDinternal* target, struct BCDvalue* source)

Converts a BCD-coded digit to its special internal representation. Helps saving code when converting a BCD value to a double.

Parameters

  • target - pointer to a struct that will hold the conversion result. The struct is as follows:
struct BCDinternal {
  int exponent;
  int sign;
  int unknown;
  char mantissa[15];
}
  • source - pointer to BCD value to convert. The struct containing it is as follows:
typedef struct {
  unsigned char hnibble:4;
  unsigned char lnibble:4;
} BCDbyte;

struct BCDvalue {
  unsigned short exponent:12;
  unsigned short mantissa0:4;
  BCDbyte mantissa[7];
  char flags;
  short info;
};

Returns

0 on success, -1 on error.