From ea4df349c4c21e36ab1d1c24cdec703b4f843299 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Mon, 8 Apr 2024 18:51:35 +0300 Subject: [PATCH] Extract a common expression into a variable/const. This is Refactoring / code cleanup. See: * https://refactoring.com/catalog/extractMethod.html * https://en.wikipedia.org/wiki/Code_refactoring * https://www.refactoring.com/ * https://www.joelonsoftware.com/2002/01/23/rub-a-dub-dub/ Some small optimisations may have slipped in as well. --- fc-solve/site/wml/src/ts/web-fc-solve.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fc-solve/site/wml/src/ts/web-fc-solve.ts b/fc-solve/site/wml/src/ts/web-fc-solve.ts index a24ac749c..ea8749a84 100644 --- a/fc-solve/site/wml/src/ts/web-fc-solve.ts +++ b/fc-solve/site/wml/src/ts/web-fc-solve.ts @@ -246,6 +246,7 @@ interface GameVariantPresetCheckRet { verdict: boolean; } +const _PTR_SIZE: number = 4; const _read_from_file_str_ptr_size: number = 32; const _arg_str_ptr_size: number = 128; @@ -747,8 +748,8 @@ export class FC_Solve { const _state_string_buffer_size: number = 500; const _move_string_buffer_size: number = 200; const _move_buffer_size: number = 64; - const _args_buffer_size: number = 4 * 2; - const _last_arg_ptr_buffer_size: number = 4; + const _args_buffer_size: number = _PTR_SIZE * 2; + const _last_arg_ptr_buffer_size: number = _PTR_SIZE; const _total_buffer_size: number = _state_string_buffer_size + _move_string_buffer_size + @@ -816,7 +817,7 @@ export class FC_Solve { ptr_type, ); that.module_wrapper.Module.setValue( - args_buf + 4, + args_buf + _PTR_SIZE, arg_str_ptr, ptr_type, );