Sign in Join
Wiki copytemporary

Shl/fi

Deutsch · English · Français · Suomi · Русский

Bittien siirto vasemmalle (SHL)

Shift left (shl) tekee bittien siirto operaation vasemmalle, Siirrettävä bittien määrä kerrotaan käskyn oikealla puolen. Päinvastainen toiminta on bittien siirto oikealle (Shr).

Esim.

text
komento: 00000100 shl 2 (siirrä kaksi bittiä vasemmalle)
 
toiminta:  00000100 <- 00 (Lisätään kaksi nollaa arvon oikealle puolelle; kaksi vasemmanpuoleista merkkiä katooa)
 
tulos on:  00010000

Nollaa bitti

pascal
function ClearBit( const aValue, aBitNumber : integer ) : integer;
begin
  result := aValue and not( 1 shl aBitNumber );
end;

Jos kutsut ClearBit(%1111,1), niin saat %1101 (Binäärinen %1111 on desimaalijärjestelmässä 15 ja vastaavasti kaksijärjestelmän %1101 on desimaalijärjestelmän 13).

Jos kutsut ClearBit(13,2), niin saat 9 (9 = %1001) .

Katso myös


From the Free Pascal wiki, page "Shl/fi", as it stood on 2020-02-26 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .

Edited on wiki.freepascal.org by 3 people, 2015–2020

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
DjzepiCreated page
DjzepiBittien siirto vasemmalle (SHL)
E-ric (minor)
TrevFixed syntax highlighting (minor)

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.