bitget - Bit at specified position (original) (raw)

Please note that the recommended version of Scilab is 2026.0.1. This page might be outdated.
See the recommended documentation of this function

Scilab help >> Elementary Functions > Bitwise operations > bitget

bit at specified position

Calling Sequence

Parameters

x :

a m-by-n matrix of doubles or a m1-by-m2-by-...-by-mm hypermatrix of doubles or a m-by-n matrix of unsigned integers (uint8, uint16 or uint32). Must contain positive integer values.

pos :

a m-by-n matrix of doubles or a m1-by-m2-by-...-by-mm hypermatrix of doubles or a m-by-n matrix of unsigned integers (uint8, uint16 or uint32). The input pos must be in the range 1,2,...,bitmax where bitmax is the maximum number of bits in x. Must contain positive integer values.

y :

a m-by-n matrix of doubles or a m1-by-m2-by-...-by-mm hypermatrix of doubles or a m-by-n matrix of unsigned integers.

Description

Given an unsigned integer x, this function returns an unsigned integer (0 or 1) which is the bit number pos from the representation binary of x.

Examples

x=uint8(19); pos=2; y = bitget(x,pos) expected = 1;

dec2bin(13) bitget(uint8(13),4:-1:1)

bitget(13,4:-1:1)

Authors