@@ -65,14 +65,14 @@ namespace pl::lib::libstd::mem {
6565 section = ctx->getUserSectionId ();
6666
6767 if (section != ptrn::Pattern::MainSectionId)
68- return 0 ;
68+ return u128 ( 0x00 ) ;
6969
7070 return u128 (ctx->getDataBaseAddress ());
7171 });
7272
7373 /* size() */
7474 runtime.addFunction (nsStdMem, " size" , FunctionParameterCount::between (0 , 1 ), [](Evaluator *ctx, auto params) -> std::optional<Token::Literal> {
75- auto section = params.size () == 1 ? params[0 ].toUnsigned () : ptrn::Pattern::MainSectionId;
75+ auto section = params.size () == 1 ? u64 ( params[0 ].toUnsigned () ) : ptrn::Pattern::MainSectionId;
7676 if (section == 0xFFFF'FFFF'FFFF'FFFF )
7777 section = ctx->getUserSectionId ();
7878
@@ -81,9 +81,9 @@ namespace pl::lib::libstd::mem {
8181
8282 /* find_sequence_in_range(occurrence_index, start_offset, end_offset, bytes...) */
8383 runtime.addFunction (nsStdMem, " find_sequence_in_range" , FunctionParameterCount::moreThan (3 ), [](Evaluator *ctx, auto params) -> std::optional<Token::Literal> {
84- const u64 occurrenceIndex = params[0 ].toUnsigned ();
85- const u64 offsetFrom = params[1 ].toUnsigned ();
86- const u64 offsetTo = params[2 ].toUnsigned ();
84+ const auto occurrenceIndex = u64 ( params[0 ].toUnsigned () );
85+ const auto offsetFrom = u64 ( params[1 ].toUnsigned () );
86+ const auto offsetTo = u64 ( params[2 ].toUnsigned () );
8787
8888 std::vector<u8 > sequence;
8989 for (u32 i = 3 ; i < params.size (); i++) {
@@ -100,20 +100,20 @@ namespace pl::lib::libstd::mem {
100100
101101 /* find_string_in_range(occurrence_index, start_offset, end_offset, string) */
102102 runtime.addFunction (nsStdMem, " find_string_in_range" , FunctionParameterCount::exactly (4 ), [](Evaluator *ctx, auto params) -> std::optional<Token::Literal> {
103- const u64 occurrenceIndex = params[0 ].toUnsigned ();
104- const u64 offsetFrom = params[1 ].toUnsigned ();
105- const u64 offsetTo = params[2 ].toUnsigned ();
106- const auto string = params[3 ].toString (false );
103+ const auto occurrenceIndex = u64 ( params[0 ].toUnsigned () );
104+ const auto offsetFrom = u64 ( params[1 ].toUnsigned () );
105+ const auto offsetTo = u64 ( params[2 ].toUnsigned () );
106+ const auto string = params[3 ].toString (false );
107107
108108 return findSequence (ctx, occurrenceIndex, offsetFrom, offsetTo, ctx->getUserSectionId (), std::vector<u8 >(string.data (), string.data () + string.size ())).value_or (-1 );
109109 });
110110
111111 /* read_unsigned(address, size, endian, section) */
112112 runtime.addFunction (nsStdMem, " read_unsigned" , FunctionParameterCount::between (3 , 4 ), [](Evaluator *ctx, auto params) -> std::optional<Token::Literal> {
113- const u64 address = params[0 ].toUnsigned ();
114- const size_t size = params[1 ].toSigned ();
113+ const auto address = u64 ( params[0 ].toUnsigned () );
114+ const auto size = std::size_t ( params[1 ].toSigned () );
115115 const types::Endian endian = params[2 ].toUnsigned ();
116- u64 section = params.size () == 4 ? params[3 ].toUnsigned () : ptrn::Pattern::MainSectionId;
116+ u64 section = params.size () == 4 ? u64 ( params[3 ].toUnsigned () ) : ptrn::Pattern::MainSectionId;
117117 if (section == 0xFFFF'FFFF'FFFF'FFFF )
118118 section = ctx->getUserSectionId ();
119119
@@ -129,10 +129,10 @@ namespace pl::lib::libstd::mem {
129129
130130 /* read_signed(address, size, endian, section) */
131131 runtime.addFunction (nsStdMem, " read_signed" , FunctionParameterCount::between (3 , 4 ), [](Evaluator *ctx, auto params) -> std::optional<Token::Literal> {
132- const u64 address = params[0 ].toUnsigned ();
133- const size_t size = params[1 ].toSigned ();
132+ const auto address = u64 ( params[0 ].toUnsigned () );
133+ const auto size = std::size_t ( params[1 ].toSigned () );
134134 const types::Endian endian = params[2 ].toUnsigned ();
135- u64 section = params.size () == 4 ? params[3 ].toUnsigned () : ptrn::Pattern::MainSectionId;
135+ u64 section = params.size () == 4 ? u64 ( params[3 ].toUnsigned () ) : ptrn::Pattern::MainSectionId;
136136 if (section == 0xFFFF'FFFF'FFFF'FFFF )
137137 section = ctx->getUserSectionId ();
138138
@@ -149,9 +149,9 @@ namespace pl::lib::libstd::mem {
149149
150150 /* read_string(address, size, endian, section) */
151151 runtime.addFunction (nsStdMem, " read_string" , FunctionParameterCount::between (2 , 3 ), [](Evaluator *ctx, auto params) -> std::optional<Token::Literal> {
152- const u64 address = params[0 ].toUnsigned ();
153- const size_t size = params[1 ].toSigned ();
154- u64 section = params.size () == 3 ? params[2 ].toUnsigned () : ptrn::Pattern::MainSectionId;
152+ const auto address = u64 ( params[0 ].toUnsigned () );
153+ const auto size = std::size_t ( params[1 ].toSigned () );
154+ u64 section = params.size () == 3 ? u64 ( params[2 ].toUnsigned () ) : ptrn::Pattern::MainSectionId;
155155 if (section == 0xFFFF'FFFF'FFFF'FFFF )
156156 section = ctx->getUserSectionId ();
157157
0 commit comments