Skip to content

Commit e587d31

Browse files
committed
Add size of Int8
1 parent 0938435 commit e587d31

File tree

6 files changed

+168
-0
lines changed

6 files changed

+168
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Number of Bytes
2+
3+
> Size (in bytes) of an 8-bit signed integer.
4+
5+
<section class="usage">
6+
7+
## Usage
8+
9+
``` javascript
10+
var INT8_NUM_BYTES = require( '@stdlib/math/constants/int8-num-bytes' );
11+
```
12+
13+
#### INT8_NUM_BYTES
14+
15+
Size (in bytes) of an 8-bit signed integer.
16+
17+
``` javascript
18+
INT8_NUM_BYTES === 1;
19+
```
20+
21+
</section>
22+
23+
<!-- /.usage -->
24+
25+
26+
<section class="examples">
27+
28+
## Examples
29+
30+
<!-- TODO: better example -->
31+
32+
``` javascript
33+
var INT8_NUM_BYTES = require( '@stdlib/math/constants/int8-num-bytes' );
34+
35+
console.log( INT8_NUM_BYTES );
36+
// => 1
37+
```
38+
39+
</section>
40+
41+
<!-- /.examples -->
42+
43+
44+
<section class="links">
45+
46+
</section>
47+
48+
<!-- /.links -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
{{alias}}
3+
Size (in bytes) of an 8-bit signed integer.
4+
5+
Examples
6+
--------
7+
> {{alias}}
8+
1
9+
10+
See Also
11+
--------
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
var INT8_NUM_BYTES = require( './../lib' );
4+
5+
console.log( INT8_NUM_BYTES );
6+
// => 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict';
2+
3+
/**
4+
* Size (in bytes) of an 8-bit signed integer.
5+
*
6+
* @module @stdlib/math/constants/int8-num-bytes
7+
* @type {integer32}
8+
*
9+
* @example
10+
* var INT8_NUM_BYTES = require( '@stdlib/math/constants/int8-num-bytes' );
11+
* // returns 1
12+
*/
13+
14+
15+
// MAIN //
16+
17+
/**
18+
* Size (in bytes) of an 8-bit signed integer.
19+
*
20+
* @constant
21+
* @type {integer32}
22+
* @default 1
23+
*/
24+
var INT8_NUM_BYTES = 1|0; // asm type annotation
25+
26+
27+
// EXPORTS //
28+
29+
module.exports = INT8_NUM_BYTES;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "@stdlib/math/constants/int8-num-bytes",
3+
"version": "0.0.0",
4+
"description": "Size (in bytes) of an 8-bit signed integer.",
5+
"author": {
6+
"name": "The Stdlib Authors",
7+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
8+
},
9+
"contributors": [
10+
{
11+
"name": "The Stdlib Authors",
12+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
13+
}
14+
],
15+
"scripts": {},
16+
"main": "./lib",
17+
"repository": {
18+
"type": "git",
19+
"url": "git://github.com/stdlib-js/stdlib.git"
20+
},
21+
"homepage": "https://github.com/stdlib-js/stdlib",
22+
"keywords": [
23+
"stdlib",
24+
"stdmath",
25+
"constant",
26+
"const",
27+
"mathematics",
28+
"math",
29+
"int8",
30+
"8-bit",
31+
"8bit",
32+
"integer",
33+
"int",
34+
"byte",
35+
"signed",
36+
"size",
37+
"sizeof",
38+
"size-of",
39+
"bytes",
40+
"nbytes",
41+
"bits"
42+
],
43+
"bugs": {
44+
"url": "https://github.com/stdlib-js/stdlib/issues"
45+
},
46+
"dependencies": {},
47+
"devDependencies": {},
48+
"engines": {
49+
"node": ">=0.10.0",
50+
"npm": ">2.7.0"
51+
},
52+
"license": "Apache-2.0"
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
3+
// MODULES //
4+
5+
var tape = require( 'tape' );
6+
var NUM_BYTES = require( './../lib' );
7+
8+
9+
// TESTS //
10+
11+
tape( 'main export is a number', function test( t ) {
12+
t.ok( true, __filename );
13+
t.equal( typeof NUM_BYTES, 'number', 'main export is a number' );
14+
t.end();
15+
});
16+
17+
tape( 'the exported value is 1', function test( t ) {
18+
t.equal( NUM_BYTES, 1, 'equals 1' );
19+
t.end();
20+
});

0 commit comments

Comments
 (0)