Difference between revisions of "BCDtoInternal"

From WikiPrizm
Jump to navigationJump to search
(Created page with "{{syscall | name = BCDtoInternal | header = fxcg/misc.h | index = 0x0160 | signature = int BCDtoInternal(struct BCDinternal* target, struct BCDvalue* source) | synopsis = Conv...")
 
Line 14: Line 14:
  
 
* '''source''' - pointer to BCD value to convert. The struct containing it is as follows:
 
* '''source''' - pointer to BCD value to convert. The struct containing it is as follows:
  <nowiki>typedef struct{
+
  <nowiki>typedef struct {
 
   unsigned char hnibble:4;
 
   unsigned char hnibble:4;
 
   unsigned char lnibble:4;
 
   unsigned char lnibble:4;
} TBCDbyte;
+
} BCDbyte;
  
typedef struct{
+
struct BCDvalue {
 
   unsigned short exponent:12;
 
   unsigned short exponent:12;
 
   unsigned short mantissa0:4;
 
   unsigned short mantissa0:4;
Line 25: Line 25:
 
   char flags;
 
   char flags;
 
   short info;
 
   short info;
} TBCDvalue;</nowiki>
+
};</nowiki>
 
| returns = 0 on success, -1 on error.
 
| returns = 0 on success, -1 on error.
 
}}
 
}}

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;
  TBCDbyte mantissa[7];
  char flags;
  short info;
};

Returns

0 on success, -1 on error.