pat [ i ]] ▁= ▁pat len - 1 ▁- ▁i ; ▁▁▁▁ ▁} ▁} ▁ ▁// ▁true ▁if ▁the ▁suffix ▁of ▁word ▁starting ▁from ▁word [ pos ] ▁is ▁a ▁prefix ▁// ▁of ▁word ▁bool ▁is _ prefix ( uint 8 _ t ▁* word , ▁size _ t ▁word len , ▁ptr diff _ t ▁pos ) ▁{ ▁▁▁▁ ▁int ▁suffix len ▁= ▁word len ▁- ▁pos ; ▁▁▁▁ ▁// ▁could ▁also ▁use ▁the ▁str nc mp () ▁library ▁function ▁here ▁▁▁▁ ▁// ▁return ▁! ▁str nc mp ( word , ▁& word [ pos ], ▁suffix len ); ▁▁▁▁ ▁for ▁( int ▁i ▁= ▁ 0 ; ▁i ▁< ▁suffix len ; ▁i ++) ▁{ ▁▁▁▁▁▁▁▁ ▁if ▁( word [ i ] ▁!= ▁word [ pos + i ]) ▁{ ▁▁▁▁▁▁▁▁▁▁▁▁ ▁return ▁false ; ▁▁▁▁▁▁▁▁ ▁} ▁▁▁▁ ▁} ▁▁▁▁ ▁return ▁true ; ▁} ▁ ▁// ▁length ▁of ▁the ▁longest ▁suffix ▁of ▁word ▁ending ▁on ▁word [ pos ]. ▁// ▁suffix _ length (" dd dbc abc ", ▁ 8 , ▁ 4 ) ▁= ▁ 2 ▁size _ t ▁suffix _ length ( uint 8 _ t ▁* word , ▁size _ t ▁word len , ▁ptr diff _ t ▁pos ) ▁{ ▁▁▁▁ ▁size _ t ▁i ; ▁▁▁▁ ▁// ▁increment ▁suffix ▁length ▁i ▁to ▁the ▁first ▁mismatch ▁or ▁beginning ▁▁▁▁ ▁// ▁of ▁the ▁word ▁▁▁▁ ▁for ▁( i ▁= ▁ 0 ; ▁( word [ pos - i ] ▁== ▁word [ word len - 1 - i