Bitwise operations: Difference between revisions

m
→‎{{header|BASIC}}: nl ww + lang tag
m (→‎{{header|BASIC}}: nl ww + lang tag)
Line 162:
=={{header|BASIC}}==
{{works with|QuickBasic|4.5}}
 
QuickBasic does not have shift or rotate operations defined. Here are the logical operations:
<prelang qbasic>SUB bitwise (a, b)
PRINT a AND b
PRINT a OR b
PRINT a XOR b
PRINT NOT a
END SUB</prelang>
 
{{works with|FreeBASIC}}
 
FreeBASIC does not have rotate operators. Shift Right operator performs arithmetic shift if the left value is signed number and logical shift if the left value is unsigned number.
<prelang freebasic>SUB bitwise (a AS Integer, b AS Integer)
DIM u AS UInteger
 
Line 183 ⟶ 185:
u = a
PRINT "a SHR b (logical) = "; u SHR b
END SUB</lang>
</pre>
 
=={{header|C}}==