gint: memory micro-optimizations

This commit is contained in:
Lephe 2024-03-19 19:03:17 +01:00
parent bc74586a2c
commit 5ff6a518f6
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
3 changed files with 13 additions and 13 deletions

View File

@ -158,7 +158,7 @@ typedef struct {
int8_t queue_next;
int8_t queue_end;
/* Number of events lost because of missing queue space */
uint events_lost;
uint16_t events_lost;
/* Event transforms */
keydev_transform_t tr;
@ -183,9 +183,9 @@ typedef struct {
// <Repeats>
/* Candidate key for repeats (or 0 if no key is candidate yet) */
int rep_key;
int16_t rep_key;
/* Number of repeats already sent */
int rep_count;
int16_t rep_count;
/* Time since key was first pressed (us) */
int rep_time;
/* Delay until next repeat, set by the repeat planner (us) */

View File

@ -40,19 +40,19 @@ extern void (*bdtors)(void), (*edtors)(void);
int main(int isappli, int optnum);
/* Whether to restart main through the OS menu rather than returning */
int gint_restart = 0;
int8_t gint_restart = 0;
/* gint_setrestart(): Set whether to restart the add-in after exiting */
void gint_setrestart(int restart)
{
gint_restart = restart;
gint_restart = !!restart;
}
/* Return value of main() */
static int8_t gint_exitcode;
/* Jumping there will properly unwind and leave the add-in (CASIOWIN does not
have an exit syscall and simply wants you to return from main()) */
jmp_buf gint_exitbuf;
/* Return value of main() */
static int gint_exitcode;
/* regcpy(): Copy a memory region using symbol information
@l Source pointer (load address)

View File

@ -17,18 +17,18 @@
#include <string.h>
#include <stdlib.h>
/* Keyboard input device for this Key Scan Interface */
static keydev_t keysc_dev;
/* Keyboard scanner timer */
int16_t keysc_tid = -1;
/* Keyboard scan frequency in Hertz. Start with 128 Hz, this frequency *must
be high* for the keyboard to work! Reading at low frequencies produces a lot
of artifacts. See https://www.casiopeia.net/forum/viewtopic.php?p=20592. */
int keysc_scan_Hz = 128;
int16_t keysc_scan_Hz = 128;
/* Approximation in microseconds, used by the timer and repeat delays */
uint32_t keysc_scan_us = 7812; /* 1000000 / keysc_scan_Hz */
/* Keyboard scanner timer */
int keysc_tid = -1;
/* Keyboard input device for this Key Scan Interface */
static keydev_t keysc_dev;
/* keydev_std(): Standard keyboard input device */
keydev_t *keydev_std(void)
{