Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
math:start [2022/07/30 11:38]
rajit [Namespace math]
math:start [2022/07/30 11:40]
rajit [Functions]
Line 4: Line 4:
  
 ===== Functions ===== ===== Functions =====
 +
 +<code act>
 +template<pint Worig, Wnew> function sign_extend (int<Worig> x) : int<Wnew>;
 +</code>
 +
 +This function takes an integer ''x'' of width ''Worig'', and sign extends its most significant bit to return a result that has width ''Wnew''. It assumes that ''Wnew'' is at least ''Worig.''
 +
 +
 +<code act>
 +template<pint Worig, Wnew> function zero_extend (int<Worig> x) : int<Wnew>;
 +</code>
 +
 +This function takes an integer ''x'' of width ''Worig'', and zero extends it to return a result that has width ''Wnew''. It assumes that ''Wnew'' is at least ''Worig.''
 +
 +