Skip to content

Commit

Permalink
mk_lang_static_param
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekKnapek committed Dec 17, 2023
1 parent 950fd24 commit 53bdb56
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 13 deletions.
1 change: 1 addition & 0 deletions mk_clib/projects/vs2022/mk_clib_slib/mk_clib_slib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_sizeof_test.h"/>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_sizet.h"/>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_static_assert.h"/>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_static_param.h"/>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_stringify.h"/>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_type_traits.h"/>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_types.h"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_sizeof_test.h"><Filter>src</Filter></ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_sizet.h"><Filter>src</Filter></ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_static_assert.h"><Filter>src</Filter></ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_static_param.h"><Filter>src</Filter></ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_stringify.h"><Filter>src</Filter></ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_type_traits.h"><Filter>src</Filter></ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\src\mk_lang_types.h"><Filter>src</Filter></ClInclude>
Expand Down
25 changes: 13 additions & 12 deletions mk_clib/src/mk_lang_num_longdivmod_inl_filec.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "mk_lang_noexcept.h"
#include "mk_lang_sizeof.h"
#include "mk_lang_static_assert.h"
#include "mk_lang_static_param.h"
#include "mk_lang_types.h"


Expand All @@ -20,7 +21,7 @@
#define mk_lang_num_longdivmod_inl_defd_overlap mk_lang_concat(mk_lang_concat(mk_lang_num_longdivmod_inl_defd_name, _overlap), _fn)


mk_lang_nodiscard mk_lang_constexpr static mk_lang_inline mk_lang_types_sint_t mk_lang_num_longdivmod_inl_defd_get_lena(mk_lang_num_longdivmod_inl_defd_tn1_pct const a) mk_lang_noexcept
mk_lang_nodiscard mk_lang_constexpr static mk_lang_inline mk_lang_types_sint_t mk_lang_num_longdivmod_inl_defd_get_lena(mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, a, mk_lang_num_longdivmod_inl_defd_lena)) mk_lang_noexcept
{
mk_lang_types_sint_t lena mk_lang_constexpr_init;
mk_lang_types_sint_t n mk_lang_constexpr_init;
Expand All @@ -42,19 +43,19 @@ mk_lang_nodiscard mk_lang_constexpr static mk_lang_inline mk_lang_types_sint_t m
return lena;
}

mk_lang_nodiscard mk_lang_constexpr static mk_lang_inline mk_lang_types_sint_t mk_lang_num_longdivmod_inl_defd_get_lenb(mk_lang_num_longdivmod_inl_defd_tn1_pct const a) mk_lang_noexcept
mk_lang_nodiscard mk_lang_constexpr static mk_lang_inline mk_lang_types_sint_t mk_lang_num_longdivmod_inl_defd_get_lenb(mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, b, mk_lang_num_longdivmod_inl_defd_lenb)) mk_lang_noexcept
{
mk_lang_types_sint_t lenb mk_lang_constexpr_init;
mk_lang_types_sint_t n mk_lang_constexpr_init;
mk_lang_types_sint_t i mk_lang_constexpr_init;

mk_lang_assert(a);
mk_lang_assert(b);

lenb = 0;
n = mk_lang_num_longdivmod_inl_defd_lenb;
for(i = 0; i != n; ++i)
{
if(!mk_lang_num_longdivmod_inl_defd_tn1_is_zero(&a[mk_lang_num_longdivmod_inl_defd_idxa((n - 1) - i)]))
if(!mk_lang_num_longdivmod_inl_defd_tn1_is_zero(&b[mk_lang_num_longdivmod_inl_defd_idxa((n - 1) - i)]))
{
lenb = n - i;
break;
Expand All @@ -65,7 +66,7 @@ mk_lang_nodiscard mk_lang_constexpr static mk_lang_inline mk_lang_types_sint_t m
}

#if mk_lang_num_longdivmod_inl_defd_lena == 1 && mk_lang_num_longdivmod_inl_defd_lenb == 1
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_1_1(mk_lang_num_longdivmod_inl_defd_tn1_pct const a, mk_lang_num_longdivmod_inl_defd_tn1_pct const b, mk_lang_num_longdivmod_inl_defd_tn1_pt const c, mk_lang_num_longdivmod_inl_defd_tn1_pt const d) mk_lang_noexcept
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_1_1(mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, a, mk_lang_num_longdivmod_inl_defd_lena), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, b, mk_lang_num_longdivmod_inl_defd_lenb), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, c, mk_lang_num_longdivmod_inl_defd_lenc), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, d, mk_lang_num_longdivmod_inl_defd_lend)) mk_lang_noexcept
{
mk_lang_static_assert(mk_lang_num_longdivmod_inl_defd_lena == 1);
mk_lang_static_assert(mk_lang_num_longdivmod_inl_defd_lenb == 1);
Expand All @@ -82,7 +83,7 @@ mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdiv
}
#endif

mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_0_n(mk_lang_num_longdivmod_inl_defd_tn1_pct const a, mk_lang_num_longdivmod_inl_defd_tn1_pct const b, mk_lang_num_longdivmod_inl_defd_tn1_pt const c, mk_lang_num_longdivmod_inl_defd_tn1_pt const d) mk_lang_noexcept
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_0_n(mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, a, mk_lang_num_longdivmod_inl_defd_lena), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, b, mk_lang_num_longdivmod_inl_defd_lenb), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, c, mk_lang_num_longdivmod_inl_defd_lenc), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, d, mk_lang_num_longdivmod_inl_defd_lend)) mk_lang_noexcept
{
mk_lang_types_sint_t n mk_lang_constexpr_init;
mk_lang_types_sint_t i mk_lang_constexpr_init;
Expand Down Expand Up @@ -112,7 +113,7 @@ mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdiv
}

#if mk_lang_num_longdivmod_inl_defd_lena >= 2 && mk_lang_num_longdivmod_inl_defd_lenb >= 2
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_b_g(mk_lang_num_longdivmod_inl_defd_tn1_pct const a, mk_lang_num_longdivmod_inl_defd_tn1_pct const b, mk_lang_num_longdivmod_inl_defd_tn1_pt const c, mk_lang_num_longdivmod_inl_defd_tn1_pt const d) mk_lang_noexcept
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_b_g(mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, a, mk_lang_num_longdivmod_inl_defd_lena), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, b, mk_lang_num_longdivmod_inl_defd_lenb), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, c, mk_lang_num_longdivmod_inl_defd_lenc), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, d, mk_lang_num_longdivmod_inl_defd_lend)) mk_lang_noexcept
{
mk_lang_types_sint_t n mk_lang_constexpr_init;
mk_lang_types_sint_t i mk_lang_constexpr_init;
Expand Down Expand Up @@ -144,7 +145,7 @@ mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdiv
#endif

#if mk_lang_num_longdivmod_inl_defd_lena >= 2
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_x_1(mk_lang_num_longdivmod_inl_defd_tn1_pct const a, mk_lang_num_longdivmod_inl_defd_tn1_pct const b, mk_lang_num_longdivmod_inl_defd_tn1_pt const c, mk_lang_num_longdivmod_inl_defd_tn1_pt const d, mk_lang_types_sint_t const lena) mk_lang_noexcept
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_x_1(mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, a, mk_lang_num_longdivmod_inl_defd_lena), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, b, mk_lang_num_longdivmod_inl_defd_lenb), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, c, mk_lang_num_longdivmod_inl_defd_lenc), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, d, mk_lang_num_longdivmod_inl_defd_lend), mk_lang_types_sint_t const lena) mk_lang_noexcept
{
mk_lang_types_sint_t n mk_lang_constexpr_init;
mk_lang_types_sint_t i mk_lang_constexpr_init;
Expand Down Expand Up @@ -213,7 +214,7 @@ mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdiv
#endif

#if mk_lang_num_longdivmod_inl_defd_lena >= 1 && mk_lang_num_longdivmod_inl_defd_lenb == 1
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_n_1(mk_lang_num_longdivmod_inl_defd_tn1_pct const a, mk_lang_num_longdivmod_inl_defd_tn1_pct const b, mk_lang_num_longdivmod_inl_defd_tn1_pt const c, mk_lang_num_longdivmod_inl_defd_tn1_pt const d) mk_lang_noexcept
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_n_1(mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, a, mk_lang_num_longdivmod_inl_defd_lena), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, b, mk_lang_num_longdivmod_inl_defd_lenb), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, c, mk_lang_num_longdivmod_inl_defd_lenc), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, d, mk_lang_num_longdivmod_inl_defd_lend)) mk_lang_noexcept
{
mk_lang_types_sint_t lena mk_lang_constexpr_init;

Expand Down Expand Up @@ -241,7 +242,7 @@ mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdiv
#endif

#if mk_lang_num_longdivmod_inl_defd_lena >= 2 && mk_lang_num_longdivmod_inl_defd_lenb >= 2
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_x_x(mk_lang_num_longdivmod_inl_defd_tn1_pct const a, mk_lang_num_longdivmod_inl_defd_tn1_pct const b, mk_lang_num_longdivmod_inl_defd_tn1_pt const c, mk_lang_num_longdivmod_inl_defd_tn1_pt const d, mk_lang_types_sint_t const lena, mk_lang_types_sint_t const lenb) mk_lang_noexcept
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_x_x(mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, a, mk_lang_num_longdivmod_inl_defd_lena), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, b, mk_lang_num_longdivmod_inl_defd_lenb), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, c, mk_lang_num_longdivmod_inl_defd_lenc), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, d, mk_lang_num_longdivmod_inl_defd_lend), mk_lang_types_sint_t const lena, mk_lang_types_sint_t const lenb) mk_lang_noexcept
{
mk_lang_types_sint_t n mk_lang_constexpr_init;
mk_lang_types_sint_t i mk_lang_constexpr_init;
Expand Down Expand Up @@ -508,7 +509,7 @@ mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdiv
#endif

#if mk_lang_num_longdivmod_inl_defd_lena >= 2 && mk_lang_num_longdivmod_inl_defd_lenb >= 2
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_n_n(mk_lang_num_longdivmod_inl_defd_tn1_pct const a, mk_lang_num_longdivmod_inl_defd_tn1_pct const b, mk_lang_num_longdivmod_inl_defd_tn1_pt const c, mk_lang_num_longdivmod_inl_defd_tn1_pt const d) mk_lang_noexcept
mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4_n_n(mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, a, mk_lang_num_longdivmod_inl_defd_lena), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, b, mk_lang_num_longdivmod_inl_defd_lenb), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, c, mk_lang_num_longdivmod_inl_defd_lenc), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, d, mk_lang_num_longdivmod_inl_defd_lend)) mk_lang_noexcept
{
mk_lang_types_sint_t lena mk_lang_constexpr_init;
mk_lang_types_sint_t lenb mk_lang_constexpr_init;
Expand Down Expand Up @@ -549,7 +550,7 @@ mk_lang_constexpr static mk_lang_inline mk_lang_types_void_t mk_lang_num_longdiv
#endif


mk_lang_constexpr mk_lang_jumbo mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4(mk_lang_num_longdivmod_inl_defd_tn1_pct const a, mk_lang_num_longdivmod_inl_defd_tn1_pct const b, mk_lang_num_longdivmod_inl_defd_tn1_pt const c, mk_lang_num_longdivmod_inl_defd_tn1_pt const d) mk_lang_noexcept
mk_lang_constexpr mk_lang_jumbo mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4(mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, a, mk_lang_num_longdivmod_inl_defd_lena), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, b, mk_lang_num_longdivmod_inl_defd_lenb), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, c, mk_lang_num_longdivmod_inl_defd_lenc), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, d, mk_lang_num_longdivmod_inl_defd_lend)) mk_lang_noexcept
{
mk_lang_static_assert(mk_lang_num_longdivmod_inl_defd_lena >= 1);
mk_lang_static_assert(mk_lang_num_longdivmod_inl_defd_lenb >= 1);
Expand Down
3 changes: 2 additions & 1 deletion mk_clib/src/mk_lang_num_longdivmod_inl_fileh.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#include "mk_lang_constexpr.h"
#include "mk_lang_jumbo.h"
#include "mk_lang_noexcept.h"
#include "mk_lang_static_param.h"
#include "mk_lang_types.h"


#include "mk_lang_num_longdivmod_inl_defd.h"


mk_lang_constexpr mk_lang_jumbo mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4(mk_lang_num_longdivmod_inl_defd_tn1_pct const a, mk_lang_num_longdivmod_inl_defd_tn1_pct const b, mk_lang_num_longdivmod_inl_defd_tn1_pt const c, mk_lang_num_longdivmod_inl_defd_tn1_pt const d) mk_lang_noexcept;
mk_lang_constexpr mk_lang_jumbo mk_lang_types_void_t mk_lang_num_longdivmod_inl_defd_divmod4(mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, a, mk_lang_num_longdivmod_inl_defd_lena), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_ct, b, mk_lang_num_longdivmod_inl_defd_lenb), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, c, mk_lang_num_longdivmod_inl_defd_lenc), mk_lang_static_param(mk_lang_num_longdivmod_inl_defd_tn1_t, d, mk_lang_num_longdivmod_inl_defd_lend)) mk_lang_noexcept;


#include "mk_lang_num_longdivmod_inl_defu.h"
15 changes: 15 additions & 0 deletions mk_clib/src/mk_lang_static_param.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef mk_include_guard_mk_lang_static_param
#define mk_include_guard_mk_lang_static_param


#include "mk_lang_version.h"


#if !defined __cplusplus && mk_lang_version_at_least_c_99
#define mk_lang_static_param(type, name, count) type const name[static count]
#else
#define mk_lang_static_param(type, name, count) type* const name
#endif


#endif

0 comments on commit 53bdb56

Please sign in to comment.