JSPM

sass-bitwise

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q9833F
  • License GNU

A library of Bitwise Operations in SASS

Package Exports

  • sass-bitwise
  • sass-bitwise/_index.scss

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sass-bitwise) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

sass-bitwise

A library of 32-Bit Bitwise Operations implemented fully in SASS.

Works similar to standard JavaScript Bitwise Operations. The library assumes inputs are positive integars, but all bitwise operations are performed on 32 bits binary numbers. Before a bitwise operation is performed, the library converts numbers to 32 bits signed integers. After the bitwise operation is performed, the result is converted back to SASS numbers.

Installation

This library can be installed using NPM.

npm install sass-bitwise

Usage

If you are having problems with your imports you may need to use the full path:

@use "../node_modules/sass-bitwise" as bitwise;

Bitwise NOT ( ~ )

SCSS

@use "bitwise" as bitwise;

@debug bitwise.bitNot(2863311530);

SASS

@use 'bitwise' as bitwise

@debug bitwise.bitNot(2863311530)

Ouput

1431655765

Bitwise AND ( & )

SCSS

@use "bitwise" as bitwise;

@debug bitwise.bitAnd(763, 93);

SASS

@use 'bitwise' as bitwise

@debug bitwise.bitAnd(763, 93)

Ouput

89

Bitwise OR ( | )

SCSS

@use "bitwise" as bitwise;

@debug bitwise.bitOr(763, 93);

SASS

@use 'bitwise' as bitwise

@debug bitwise.bitOr(763, 93)

Ouput

767

Bitwise XOR ( ^ )

SCSS

@use "bitwise" as bitwise;

@debug bitwise.bitXor(763, 93);

SASS

@use 'bitwise' as bitwise

@debug bitwise.bitXor(763, 93)

Ouput

678

Bitwise Left Shift ( << )

SCSS

@use "bitwise" as bitwise;

@debug bitwise.bitLShift(763, 3);

SASS

@use 'bitwise' as bitwise

@debug bitwise.bitLShift(763, 3)

Ouput

6104

Bitwise Arithmetic Right Shift ( >> )

SCSS

@use "bitwise" as bitwise;

@debug bitwise.bitSignShift(763, 3);

SASS

@use 'bitwise' as bitwise

@debug bitwise.bitSignShift(763, 3)

Ouput

95

Bitwise Logical Right Shift ( >>> )

SCSS

@use "bitwise" as bitwise;

@debug bitwise.bitRShift(763, 3);

SASS

@use 'bitwise' as bitwise

@debug bitwise.bitRShift(763, 3)

Ouput

95