Skip to content

Commit e9e3484

Browse files
Updated NSTD_FILE_* constants.
1 parent b426ac7 commit e9e3484

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

include/nstd/fs/file.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@
1111
///
1212
/// Either of the `NSTD_FILE_WRITE` or `NSTD_FILE_APPEND` options must also be toggled for the file
1313
/// to be created.
14-
#define NSTD_FILE_CREATE 0b00000001
14+
#define NSTD_FILE_CREATE 1
1515

1616
/// Open a file in read mode.
17-
#define NSTD_FILE_READ 0b00000010
17+
#define NSTD_FILE_READ (1 << 1)
1818

1919
/// Open a file in write mode.
20-
#define NSTD_FILE_WRITE 0b00000100
20+
#define NSTD_FILE_WRITE (1 << 2)
2121

2222
/// Open a file in writing mode without overwriting saved data.
23-
#define NSTD_FILE_APPEND 0b00001000
23+
#define NSTD_FILE_APPEND (1 << 3)
2424

2525
/// Open a file in truncate mode, this will set the file's length to 0 upon opening.
26-
#define NSTD_FILE_TRUNC 0b00010000
26+
#define NSTD_FILE_TRUNC (1 << 4)
2727

2828
/// A handle to an opened file.
2929
typedef NSTDAnyMut NSTDFile;

src/fs/file.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ use std::fs::File;
1515
///
1616
/// Either of the `NSTD_FILE_WRITE` or `NSTD_FILE_APPEND` options must also be toggled for the file
1717
/// to be created.
18-
pub const NSTD_FILE_CREATE: NSTDUInt8 = 0b00000001;
18+
pub const NSTD_FILE_CREATE: NSTDUInt8 = 1;
1919

2020
/// Open a file in read mode.
21-
pub const NSTD_FILE_READ: NSTDUInt8 = 0b00000010;
21+
pub const NSTD_FILE_READ: NSTDUInt8 = 1 << 1;
2222

2323
/// Open a file in write mode.
24-
pub const NSTD_FILE_WRITE: NSTDUInt8 = 0b00000100;
24+
pub const NSTD_FILE_WRITE: NSTDUInt8 = 1 << 2;
2525

2626
/// Open a file in writing mode without overwriting saved data.
27-
pub const NSTD_FILE_APPEND: NSTDUInt8 = 0b00001000;
27+
pub const NSTD_FILE_APPEND: NSTDUInt8 = 1 << 3;
2828

2929
/// Open a file in truncate mode, this will set the file's length to 0 upon opening.
30-
pub const NSTD_FILE_TRUNC: NSTDUInt8 = 0b00010000;
30+
pub const NSTD_FILE_TRUNC: NSTDUInt8 = 1 << 4;
3131

3232
/// A handle to an opened file.
3333
pub type NSTDFile = Box<File>;

0 commit comments

Comments
 (0)