Skip to content

Remove xnum conversions #203

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

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
88a97f3
Conversions to c++
juntuu Feb 28, 2021
2ef2302
Add templated functions for simple conversions
juntuu Mar 6, 2021
223413f
Remove tautologically true #ifdef
juntuu Mar 6, 2021
7558baf
Add range check to `convert()`
juntuu Mar 6, 2021
d3187f7
Refactor `jtDfromX()`
juntuu Mar 6, 2021
f8d612b
Const refactor `jtDfromQ()`
juntuu Mar 6, 2021
d308fbf
Refactor `jtXfromI()`
juntuu Mar 6, 2021
bd25196
Extract couple helper functions
juntuu Mar 6, 2021
12fc5b9
Refactor couple transforms
juntuu Mar 6, 2021
7372afb
Remove some decl-init split
juntuu Mar 6, 2021
463b02f
Add specialisations for `convert()`
juntuu Mar 6, 2021
77c0105
Remove more decl-init split
juntuu Mar 6, 2021
bda0f83
Add helper function
juntuu Mar 7, 2021
34a427d
Use helper functions more
juntuu Mar 7, 2021
ab99794
Parametrise `pointer_to_values()` return type
juntuu Mar 7, 2021
fe73293
Replace `*AV()` macros with `pointer_to_values()`
juntuu Mar 7, 2021
300efec
Use `array` instead of `A`
juntuu Mar 7, 2021
b0069a6
Until c++17
juntuu Mar 7, 2021
5935520
Use true/false for booleans, replace C-style casts
juntuu Mar 7, 2021
b528de2
Add stdbool.h and extern "C" guards in j.h
juntuu Mar 7, 2021
079d171
Chain conversion pairs with &&
juntuu Mar 7, 2021
acc08ba
Inline `pointer_to_values<void>()` with correct types
juntuu Mar 7, 2021
3b340f7
Remove pointer_to_values() type parameter default
juntuu Mar 7, 2021
a0379e4
Add checked transform variant of convert()
juntuu Mar 7, 2021
d860c28
Use convert() instead of raw loops
juntuu Mar 8, 2021
10504fc
Replace std::copy_n() with convert()
juntuu Mar 8, 2021
194cbc4
Refactor conversions to complex (Z)
juntuu Mar 8, 2021
4c39a04
Make the CI compiler happy
juntuu Mar 8, 2021
7229958
Add missing parentheses
juntuu Mar 16, 2021
c993b44
Replace `I` and `D` with correct types
juntuu Mar 16, 2021
b71a020
Extract transformation lambda to variable
juntuu Mar 16, 2021
05d91c6
Remove unnecessary special case
juntuu Mar 16, 2021
2110d69
Use std::negate{}
juntuu Mar 16, 2021
86ae356
Use std::div()
juntuu Mar 17, 2021
d5cc1b9
Disable bool-compare warning
juntuu Mar 17, 2021
0dbbd21
Remove XNUM conversions
juntuu Mar 7, 2021
1950860
Fix tests and remove empty test files
juntuu Feb 12, 2021
931bd68
Remove unused XNUM conversion functions
juntuu Mar 7, 2021
0e095fe
Make conversion to XNUM error in jtxco1()
juntuu Mar 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-char-subscripts>)
add_compile_options($<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang>:-Wno-string-plus-int>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-missing-braces>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-unknown-pragmas>)
add_compile_options($<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wno-bool-compare>)


add_subdirectory(jsrc)
add_subdirectory(base64)
Expand Down
2 changes: 1 addition & 1 deletion jsrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ target_sources(j PRIVATE
io.c
j.c
jdlllic.c
k.c
conversions.cpp
m.c
parsing/p.c
parsing/pv.c
Expand Down
7 changes: 4 additions & 3 deletions jsrc/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ num(int64_t n) {
return reinterpret_cast<array>(Bnum[n - NUMMIN]);
}

template <typename Value>
[[nodiscard]] inline auto
pointer_to_values(array x) -> int64_t* {
return reinterpret_cast<int64_t*>(reinterpret_cast<C*>(x) + x->kchain.k);
pointer_to_values(array x) -> Value* {
return reinterpret_cast<Value*>(reinterpret_cast<C*>(x) + x->kchain.k);
}

[[nodiscard]] constexpr auto
Expand All @@ -49,7 +50,7 @@ is_sparse(array x) noexcept -> bool {
template <typename T>
auto
set_value_at(array x, int32_t index, T const& value) -> void {
pointer_to_values(x)[index] = value;
pointer_to_values<T>(x)[index] = value;
}

// TODO: remove eventually, temporary while c_types exist
Expand Down
Loading