Skip to content

Commit f817a47

Browse files
committed
prepare for f128,f256
1 parent 22efa07 commit f817a47

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Special thanks to the following contributors and inspirations:
147147
## Roadmap
148148

149149
- [ ] Big-endian support
150-
- [ ] f16 support
150+
- [x] f16 support
151151
- [x] f32 support
152152
- [x] f64 support
153153
- [ ] f128 support

bench/xjb/float_to_string/ftoa.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,22 @@ static inline char* xjb16(uint16_t bits, char* buf) {
16621662
memcpy(buf, &exp_result, 8);
16631663
return buf + exp_len;
16641664
}
1665+
static inline char* xjb128(uint64_t v_hi64, uint64_t v_lo64, char* buf) {
1666+
// todo
1667+
// v = {v_hi64, v_lo64} ; v_hi64 is the highest 64bits, v_lo64 is the lowest 64bits
1668+
1669+
// 128 bit = 1 + 15 + 112; sign + exp + sig
1670+
1671+
return buf;
1672+
}
1673+
static inline char* xjb256(uint64_t* v,char* buf){
1674+
// todo
1675+
// v = {v[0], v[1], v[2], v[3]} ; v[0] is the highest 64bits, v[3] is the lowest 64bits
1676+
1677+
// 256 bit = 1 + 19 + 236; sign + exp + sig
1678+
1679+
return buf;
1680+
}
16651681
} // end of namespace xjb
16661682

16671683
/*==============================================================================
@@ -1676,4 +1692,10 @@ char* xjb_ftoa(float v, char* buf) {
16761692
}
16771693
char* xjb_ftoa(double v, char* buf) {
16781694
return xjb::xjb64(v, buf);
1695+
}
1696+
char* xjb_ftoa(uint64_t v_hi64, uint64_t v_lo64, char* buf) {
1697+
return xjb::xjb128(v_hi64, v_lo64, buf);
1698+
}
1699+
char* xjb_ftoa(uint64_t* v, char* buf) {
1700+
return xjb::xjb256(v, buf);
16791701
}

0 commit comments

Comments
 (0)