Shl/ru
Deutsch · English · Français · Suomi · Русский
Обзор
Shift left (shl) выполняет операцию битового сдвига влево, сдвигая значение на количество бит, указанное в аргументе (противоположное действие shr).
Например
Команда: 00000100 shl 2 (сдвиг влево на 2 бита)
Действие: 00000100 <- 00 (00 добавляется справа к значению; слева 00 "теряется")
Результат: 00010000Сбросить бит
function ClearBit( const aValue, aBitNumber : integer ) : integer;
begin
result := aValue and not( 1 shl aBitNumber );
end;Если вы вызовете ClearBit(%1111,1), то получите %1101 (двоичное число %1111 это 15, а %1101 = 13).
Если вызовете ClearBit(13,2), то получите 9 (9 = %1001) .
См. также
From the Free Pascal wiki, page "Shl/ru", 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.
Edited on wiki.freepascal.org by 2 people, 2018–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.
| When | Who | What changed |
|---|---|---|
| Useroflazarus | Created page | |
| Useroflazarus | ||
| Trev | Fixed syntax highlighting; deleted category included in page template (minor) |
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
