pdp10-extint: drop typedef, rename x[] field to nonet[]

This commit is contained in:
Mikael Pettersson
2013-07-05 16:58:19 +00:00
parent 5d2fd7e2b3
commit 8ea37e57b9
2 changed files with 26 additions and 26 deletions

View File

@@ -11,18 +11,18 @@
#include "pdp10-stdint.h"
typedef struct {
pdp10_uint9_t x[2];
} pdp10_ext_uint18_t;
struct pdp10_ext_uint18 {
pdp10_uint9_t nonet[2];
};
void pdp10_uint18_to_ext(pdp10_uint18_t val, pdp10_ext_uint18_t *ext);
pdp10_uint18_t pdp10_uint18_from_ext(const pdp10_ext_uint18_t *ext);
void pdp10_uint18_to_ext(pdp10_uint18_t val, struct pdp10_ext_uint18 *ext);
pdp10_uint18_t pdp10_uint18_from_ext(const struct pdp10_ext_uint18 *ext);
typedef struct {
pdp10_uint9_t x[4];
} pdp10_ext_uint36_t;
struct pdp10_ext_uint36 {
pdp10_uint9_t nonet[4];
};
void pdp10_uint36_to_ext(pdp10_uint36_t val, pdp10_ext_uint36_t *ext);
pdp10_uint36_t pdp10_uint36_from_ext(const pdp10_ext_uint36_t *ext);
void pdp10_uint36_to_ext(pdp10_uint36_t val, struct pdp10_ext_uint36 *ext);
pdp10_uint36_t pdp10_uint36_from_ext(const struct pdp10_ext_uint36 *ext);
#endif /* PDP10_EXTINT_H */

View File

@@ -13,32 +13,32 @@
* as does the layout of its 72-bit long integers.
*/
void pdp10_uint18_to_ext(pdp10_uint18_t val, pdp10_ext_uint18_t *ext)
void pdp10_uint18_to_ext(pdp10_uint18_t val, struct pdp10_ext_uint18 *ext)
{
ext->x[0] = (val >> 9) & 0x1FF;
ext->x[1] = val & 0x1FF;
ext->nonet[0] = (val >> 9) & 0x1FF;
ext->nonet[1] = val & 0x1FF;
}
pdp10_uint18_t pdp10_uint18_from_ext(const pdp10_ext_uint18_t *ext)
pdp10_uint18_t pdp10_uint18_from_ext(const struct pdp10_ext_uint18 *ext)
{
return
((pdp10_uint18_t)(ext->x[0] & 0x1FF) << 9)
| (ext->x[1] & 0x1FF);
((pdp10_uint18_t)(ext->nonet[0] & 0x1FF) << 9)
| (ext->nonet[1] & 0x1FF);
}
void pdp10_uint36_to_ext(pdp10_uint36_t val, pdp10_ext_uint36_t *ext)
void pdp10_uint36_to_ext(pdp10_uint36_t val, struct pdp10_ext_uint36 *ext)
{
ext->x[0] = (val >> 27) & 0x1FF;
ext->x[1] = (val >> 18) & 0x1FF;
ext->x[2] = (val >> 9) & 0x1FF;
ext->x[3] = val & 0x1FF;
ext->nonet[0] = (val >> 27) & 0x1FF;
ext->nonet[1] = (val >> 18) & 0x1FF;
ext->nonet[2] = (val >> 9) & 0x1FF;
ext->nonet[3] = val & 0x1FF;
}
pdp10_uint36_t pdp10_uint36_from_ext(const pdp10_ext_uint36_t *ext)
pdp10_uint36_t pdp10_uint36_from_ext(const struct pdp10_ext_uint36 *ext)
{
return
((pdp10_uint36_t)(ext->x[0] & 0x1FF) << 27)
| ((pdp10_uint36_t)(ext->x[1] & 0x1FF) << 18)
| ((pdp10_uint36_t)(ext->x[2] & 0x1FF) << 9)
| (ext->x[3] & 0x1FF);
((pdp10_uint36_t)(ext->nonet[0] & 0x1FF) << 27)
| ((pdp10_uint36_t)(ext->nonet[1] & 0x1FF) << 18)
| ((pdp10_uint36_t)(ext->nonet[2] & 0x1FF) << 9)
| (ext->nonet[3] & 0x1FF);
}