Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

left shift or right shift operator usage example please

Status
Not open for further replies.

6839470

Programmer
Mar 7, 2004
45
US
I need an example code for left or right shift operator.
anyone ?/..
like
for (j=7; j>=0, j--) {
if ( (1 << j) &rew_y)
{
puts "done"
}
}

equivalent thing in tcl??
 
Tcl uses the same expressions as C but needs a expr command if the expression is ouside a if command.
Code:
  set rew_y 7
  for {set j 7} {j >= 0} {incr j -1}   {
    if ( (1 << j) & rew_y(i) )     { 
      puts "done"
    } 
  }
(not tested)

More on the Tcl expressions at:
HTH

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top