-
Notifications
You must be signed in to change notification settings - Fork 11
Add common types into definitions #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ded55b9
Add common types into definitions
JoltedJon 79c4e5d
Move defs to own file and replace usages
JoltedJon f6fdaf6
Migrate math to stdtypes
VictorSohier a8d1cfd
Move allocators to stdtypes
VictorSohier 611d1a5
Add common types into definitions
JoltedJon 531ffab
Move defs to own file and replace usages
JoltedJon 13767b3
Merge branch 'common-defs' into jon/common-defs
JoltedJon af6dc32
Merge pull request #1 from VictorSohier/jon/common-defs
JoltedJon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| add_modules_library(definitions PIC) | ||
| add_modules_library(math) | ||
| add_modules_library(memory) | ||
| target_link_libraries(math PUBLIC definitions) | ||
| target_link_libraries(math PUBLIC definitions) | ||
| target_link_libraries(memory PUBLIC definitions) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| module; | ||
|
|
||
| #include <cstddef> | ||
| #include <cstdint> | ||
|
|
||
| export module core.stdtypes; | ||
|
|
||
| export namespace draco { | ||
| using i8 = int8_t; | ||
| using i16 = int16_t; | ||
| using i32 = int32_t; | ||
| using i64 = int64_t; | ||
|
|
||
| using uint = unsigned int; | ||
| using u8 = uint8_t; | ||
| using u16 = uint16_t; | ||
| using u32 = uint32_t; | ||
| using u64 = uint64_t; | ||
|
|
||
| using f32 = float; | ||
| using f64 = double; | ||
|
|
||
| using isize = int64_t; | ||
| using usize = std::size_t; | ||
|
|
||
| using rawptr = void *; | ||
| using uintptr = uintptr_t; | ||
| using ptrdiff = ptrdiff_t; | ||
|
|
||
| // UTF-32 type | ||
| using rune = u32; | ||
|
|
||
| } // namespace draco | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,29 @@ | ||
| module; | ||
|
|
||
| #include <cstdint> | ||
| #include <format> | ||
|
|
||
| export module core.version; | ||
| import core.stdtypes; | ||
|
|
||
| export namespace draco { | ||
|
|
||
| struct Version { | ||
| std::uint16_t major; | ||
| std::uint16_t minor; | ||
| std::uint16_t patch; | ||
| }; | ||
| struct Version { | ||
| u16 major; | ||
| u16 minor; | ||
| u16 patch; | ||
| }; | ||
|
|
||
| constexpr Version VERSION { .major = 2026, .minor = 0, .patch = 0 }; | ||
| } | ||
| constexpr Version VERSION{.major = 2026, .minor = 0, .patch = 0}; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } // namespace draco | ||
|
|
||
| export namespace std { | ||
| template<> struct formatter<draco::Version> { | ||
| constexpr auto parse(std::format_parse_context& ctx) { | ||
| return ctx.begin(); // Accept any format spec (or parse custom ones) | ||
| } | ||
| template <> struct formatter<draco::Version> { | ||
| constexpr auto parse(std::format_parse_context &ctx) { | ||
| return ctx.begin(); // Accept any format spec (or parse custom ones) | ||
| } | ||
|
OldDev78 marked this conversation as resolved.
|
||
|
|
||
| auto format(const draco::Version& v, std::format_context& ctx) const { | ||
| return std::format_to(ctx.out(), "{}.{}.{}", v.major, v.minor, v.patch); | ||
| } | ||
| }; | ||
| } | ||
| auto format(const draco::Version &v, std::format_context &ctx) const { | ||
| return std::format_to(ctx.out(), "{}.{}.{}", v.major, v.minor, v.patch); | ||
| } | ||
| }; | ||
| } // namespace std | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if
ssizewould be a better name (likestd::ssize_t), but that's not terribly important.Not worth going back and renaming everything for this.