chiark / gitweb /
safety: movpos: new function movposcomb_feature_posn
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 19 Feb 2011 12:23:35 +0000 (12:23 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 19 Feb 2011 12:23:35 +0000 (12:23 +0000)
hostside/movpos.c
hostside/safety.h

index 2d05b3c4b5de711d1c72e42d995c0f76c006cc27..75a139d93b73e7cfdac8615ea96ecea8631a5386 100644 (file)
@@ -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;
index 83b570c0fd6d05e8363881f0c81f8ab7ef84708a..ff58d9603c4a0f93ff51e8bfd05d65ce4e409e94 100644 (file)
@@ -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 ==========*/