OpenLibm working on 16-bit 8086
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 28/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- c
- Área
- compilers, operating-systems
Línea de trabajo
Revisa src/fpmath.h, src/i386_fpmath.h y src/math_private.h junto con el contexto proporcionado de ELKS y ia16-elf-gcc. Comprueba las suposiciones existentes sobre los anchos de enteros y los campos de bits, y después compila o prueba la biblioteca para el destino de 16 bits. Se considera terminado cuando el problema de portabilidad está resuelto sin romper los layouts existentes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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!
- Lenguaje dominante
- C
- Estrellas
- 632
- Forks
- 163
- Merge medio
- 4 min
- PR fusionados (30 d)
- 1
Preparar el entorno
Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de JuliaMath/openlibm
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
issues found by openlibm-testAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
Sync patches from upstream (BSD)Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Todos los issues de JuliaMath/openlibm
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
DaveGamble/cJSON#1094 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Status: Opened
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Issue-Bug Needs-Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día