OpenLibm working on 16-bit 8086
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 28/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- c
調査の方向性
提供された ELKS および ia16-elf-gcc のコンテキストと併せて、src/fpmath.h、src/i386_fpmath.h、src/math_private.h を確認してください。既存の整数幅とビットフィールドに関する前提を確認し、その後 16 ビットターゲット向けにライブラリをビルドまたはテストしてください。既存のレイアウトを壊さずに移植性の問題が解決されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hello all,
I'm not sure whether anyone is interested in this, but I have successfully ported a number of the OpenLibm math routines to ELKS, an 8086-based Linux kernel and C library, using the ia16-elf-gcc compiler. In this system, int is 16 bits, and long 32 bits. float and double are IEEE 754 32 and 64 bits.
The following patch was required. It may (or may not) be a good idea to consider changing the non-portable unsigned int definitions to something like uint32_t for portability. Not knowing this library well, I am unsure whether unsigned int may need to be 64 bits on some systems, in which case, this would not work. However, it seems the IEEEf2bits structure assumes unsigned int to be 32 bits for its bitfield definitions.
diff --git a/src/fpmath.h b/src/fpmath.h
index 6c37595..5843386 100644
--- a/src/fpmath.h
+++ b/src/fpmath.h
@@ -83,13 +83,13 @@ union IEEEf2bits {
float f;
struct {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- unsigned int man :23;
- unsigned int exp :8;
- unsigned int sign :1;
+ unsigned long man :23;
+ unsigned long exp :8;
+ unsigned long sign :1;
#else /* _BIG_ENDIAN */
- unsigned int sign :1;
- unsigned int exp :8;
- unsigned int man :23;
+ unsigned long sign :1;
+ unsigned long exp :8;
+ unsigned long man :23;
#endif
} bits;
};
@@ -102,19 +102,19 @@ union IEEEd2bits {
struct {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#if __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
- unsigned int manl :32;
+ unsigned long manl :32;
#endif
- unsigned int manh :20;
- unsigned int exp :11;
- unsigned int sign :1;
+ unsigned long manh :20;
+ unsigned long exp :11;
+ unsigned long sign :1;
#if __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
- unsigned int manl :32;
+ unsigned long manl :32;
#endif
#else /* _BIG_ENDIAN */
- unsigned int sign :1;
- unsigned int exp :11;
- unsigned int manh :20;
- unsigned int manl :32;
+ unsigned long sign :1;
+ unsigned long exp :11;
+ unsigned long manh :20;
+ unsigned long manl :32;
#endif
} bits;
};
diff --git a/src/i386_fpmath.h b/src/i386_fpmath.h
index 455631c..8b29e38 100644
--- a/src/i386_fpmath.h
+++ b/src/i386_fpmath.h
@@ -29,16 +29,16 @@
union IEEEl2bits {
long double e;
struct {
- unsigned int manl :32;
- unsigned int manh :32;
- unsigned int exp :15;
- unsigned int sign :1;
- unsigned int junk :16;
+ unsigned long manl :32;
+ unsigned long manh :32;
+ unsigned long exp :15;
+ unsigned long sign :1;
+ unsigned long junk :16;
} bits;
struct {
unsigned long long man :64;
- unsigned int expsign :16;
- unsigned int junk :16;
+ unsigned long expsign :16;
+ unsigned long junk :16;
} xbits;
};
diff --git a/src/math_private.h b/src/math_private.h
index 15a27b2..4f7e1d4 100644
--- a/src/math_private.h
+++ b/src/math_private.h
@@ -162,7 +162,7 @@ typedef union
{
float value;
/* FIXME: Assumes 32 bit int. */
- unsigned int word;
+ unsigned long word;
} ieee_float_shape_type;
/* Get a 32 bit int from a float. */
Thank you!
- 主要言語
- C
- スター
- 637
- フォーク
- 165
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaMath/openlibm のほかの issue
-
nextafter and nexttoward return the finite endpoint in directed rounding modes対応中かも @vera-rubin が 4 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
Non-standard behavior of tgamma()対応中かも @ViralBShah が 118 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
JuliaMath/openlibm の issue をすべて見る
似ている issue
-
os:linux
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
mpv-player/mpv#18649 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
facebookincubator/muse-gadget-sdk#249 ·
メンテナーはふだん 1 日以内に返信
-
docs: nng_dial / nng_dialer_start can return NNG_ECONNSHUT and NNG_ECRYPTO, which are not documentedオープン
難易度 1/5 1〜3時間 初心者へのやさしさ 89/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
micropython/micropython#19786 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
vercel-labs/zerolang#442 ·