finally fix bpermd pseudocode, index was being treated as signed