From bcb6edfb8af4f3d2cd56fb7bf6ffea615d0146c5 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Thu, 18 Sep 2008 17:59:16 +0100 Subject: [PATCH] include PtoAtomHashEntryAdjust to reduce casts --- C/agc.c | 1 + H/rheap.h | 4 ++-- H/sshift.h | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/C/agc.c b/C/agc.c index a61fdbb39..9a8ef23fe 100644 --- a/C/agc.c +++ b/C/agc.c @@ -134,6 +134,7 @@ AtomAdjust(Atom a) #define BlobTermAdjust(P) (P) #define CodeComposedTermAdjust(P) (P) #define CellPtoHeapAdjust(P) (P) +#define PtoAtomHashEntryAdjust(P) (P) #define CellPtoHeapCellAdjust(P) (P) #define CellPtoTRAdjust(P) (P) #define CodeAddrAdjust(P) (P) diff --git a/H/rheap.h b/H/rheap.h index bb050d36d..0048c2310 100644 --- a/H/rheap.h +++ b/H/rheap.h @@ -1065,9 +1065,9 @@ restore_codes(void) Yap_heap_regs->logdb_erased_marker->ClPred = PtoPredAdjust(Yap_heap_regs->logdb_erased_marker->ClPred); Yap_heap_regs->hash_chain = - (AtomHashEntry *)PtoHeapCellAdjust((CELL *)(Yap_heap_regs->hash_chain)); + PtoAtomHashEntryAdjust(Yap_heap_regs->hash_chain); Yap_heap_regs->wide_hash_chain = - (AtomHashEntry *)PtoHeapCellAdjust((CELL *)(Yap_heap_regs->wide_hash_chain)); + PtoAtomHashEntryAdjust(Yap_heap_regs->wide_hash_chain); } diff --git a/H/sshift.h b/H/sshift.h index d47ece7fe..ed243e28e 100644 --- a/H/sshift.h +++ b/H/sshift.h @@ -593,6 +593,14 @@ PtoHeapCellAdjust (CELL * ptr) return (CELL *) (((CELL *) (CharP (ptr) + HDiff))); } +inline EXTERN AtomHashEntry *PtoAtomHashEntryAdjust (AtomHashEntry *); + +inline EXTERN AtomHashEntry * +PtoAtomHashEntryAdjust (AtomHashEntry * ptr) +{ + return (AtomHashEntry *) (((AtomHashEntry *) (CharP (ptr) + HDiff))); +} + inline EXTERN PredEntry *PtoPredAdjust (PredEntry *);