From fe3d5809b4a1f0b8186d3e3fb76dc36ef6d08718 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 19 Feb 2011 12:23:35 +0000 Subject: [PATCH] safety: movpos: new function movposcomb_feature_posn --- hostside/movpos.c | 5 +++++ hostside/safety.h | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hostside/movpos.c b/hostside/movpos.c index 2d05b3c..75a139d 100644 --- a/hostside/movpos.c +++ b/hostside/movpos.c @@ -131,6 +131,11 @@ static void ouposn_feat(const Segment *move, const MovFeatInfo *feati, feati->pname, posn, m->pname); } +int movposcomb_feature_posn(const MovFeatInfo *feati, MovPosComb comb) { + /* Returns position of individual feature. */ + return (comb / feati->weight) % feati->posns; +} + MovPosComb movposcomb_feature_update(const MovFeatInfo *mfi, MovPosComb startpoint, int featpos) { MovPosComb above_weight= mfi->weight * mfi->posns; diff --git a/hostside/safety.h b/hostside/safety.h index 83b570c..ff58d96 100644 --- a/hostside/safety.h +++ b/hostside/safety.h @@ -241,11 +241,16 @@ MovPosComb movpos_change_intent(MovPosChange *chg); const char *movpos_pname(const Segment *move, MovPosComb poscomb); + +/* Pure functions for manipulating MovPosComb values: */ + +int movposcomb_feature_posn(const MovFeatInfo *mfi, MovPosComb comb); + /* Returns position of individual feature. */ + MovPosComb movposcomb_feature_update(const MovFeatInfo *mfi, MovPosComb startpoint, int featpos); - /* Returns movposcomb representing a changed combination of positions; - * pure function. */ + /* Returns movposcomb representing a changed combination of positions */ /*========== speed.c ==========*/ -- 2.30.2