You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also integer.setBit, integer.toggleBit and integer.getBit functions could be improved:
set-bit.ts
// Current.exportdefault(int32: number,position: number,value: Bit): Bit=><Bit>(value===1 ? int32|(1<<position) : int32&~(1<<position))// Proposed. The return type should be number, not Bit.exportdefault(int32: number,position: number,value: Bit): number=>(value===1 ? int32|(1<<position) : int32&~(1<<position))// Proposed. Would be nice if we could pass a boolean to setBit.exportdefault(int32: number,position: number,value: Bit|boolean): number=>(!!value ? int32|(1<<position) : int32&~(1<<position))
toggle-bit.ts
// Current.exportdefault(int32: number,position: number)=>int32^(1<<position)// Proposed. The return type should be specified.exportdefault(int32: number,position: number): number=>int32^(1<<position)
get-bit.ts
// Current.exportdefault(int32: number,position: number): Bit=><Bit>((int32>>position)&1)// Proposed. Unsigned right shift should be used.exportdefault(int32: number,position: number): Bit=><Bit>((int32>>>position)&1)
The text was updated successfully, but these errors were encountered:
aandrejevas
changed the title
Add integer.addBit and integer.removeBit
Add integer.addBit, integer.removeBit and improve integer.setBit, integer.toggleBit, integer.getBit
Aug 22, 2024
Hello, integer.addBit and integer.removeBit methods should be added to the library.
An implementation could look like this:
Also integer.setBit, integer.toggleBit and integer.getBit functions could be improved:
The text was updated successfully, but these errors were encountered: