semisedlak/bitmasking
最新稳定版本:0.1.0
Composer 安装命令:
composer require semisedlak/bitmasking
包简介
Simple bitmasking utility
关键字:
README 文档
README
This simple library provides a set of functions for easier life when dealing with bitmasks.
You can install it using composer:
$ composer require semisedlak/bitmasking
How it works
Create your own bitmask class which extends from Semisedlak\Bitmasking\Bitmask class. Define your bitmask constants in this class. Set the $bitmask property and your $maxBits property (in fact it means how many "settings" will you have).
Good to know
When defining a bitmask constants use powers of two, e.g.:
const BIT_1 = 1; // 1 << 0 const BIT_2 = 2; // 1 << 1 const BIT_3 = 4; // 1 << 2 const BIT_4 = 8; // 1 << 3 const BIT_5 = 16; // 1 << 4 const BIT_ALL = BIT_1 | BIT_2 | BIT_3 | BIT_4 | BIT_5;
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-02