Skip to content

Commit bb91b11

Browse files
committed
make new functions inline, making them faster in the callback
1 parent 6edb95b commit bb91b11

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

libogc/console.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ PrintConsole currentCopy;
149149

150150
PrintConsole* currentConsole = &currentCopy;
151151

152-
static void *__console_offset_by_pixels(void *ptr, s32 dy_pixels, u32 stride_bytes, s32 dx_pixels)
152+
static inline void *__console_offset_by_pixels(void *ptr, s32 dy_pixels, u32 stride_bytes, s32 dx_pixels)
153153
{
154154
const s32 dy_bytes = dy_pixels * stride_bytes;
155155
const s32 dx_bytes = dx_pixels * VI_DISPLAY_PIX_SZ;
@@ -158,12 +158,12 @@ static void *__console_offset_by_pixels(void *ptr, s32 dy_pixels, u32 stride_byt
158158

159159
// cursor_y and cursor_x are 1-indexed tile offsets (to start of tile), window offsets are a type of cursor
160160
// window/console dimensions are a count of tiles, but 0-indexed
161-
static void *__console_offset_by_cursor(void *ptr, u32 cursor_y, u32 stride_bytes, u32 cursor_x)
161+
static inline void *__console_offset_by_cursor(void *ptr, u32 cursor_y, u32 stride_bytes, u32 cursor_x)
162162
{
163163
return __console_offset_by_pixels(ptr, (cursor_y - 1) * FONT_YSIZE, stride_bytes, (cursor_x - 1) * FONT_XSIZE);
164164
}
165165

166-
static void *__console_get_buffer_start_ptr()
166+
static inline void *__console_get_buffer_start_ptr()
167167
{
168168
if(!currentConsole)
169169
return NULL;
@@ -183,7 +183,7 @@ static void *__console_get_buffer_start_ptr()
183183
: __console_offset_by_pixels(currentConsole->destbuffer, currentConsole->target_y, currentConsole->tgt_stride, currentConsole->target_x);
184184
}
185185

186-
static void *__console_get_window_start_ptr()
186+
static inline void *__console_get_window_start_ptr()
187187
{
188188
PrintConsole *con;
189189
if( !(con = currentConsole) )
@@ -192,7 +192,7 @@ static void *__console_get_window_start_ptr()
192192
return __console_offset_by_cursor(__console_get_buffer_start_ptr(), con->windowY, con->con_stride, con->windowX);
193193
}
194194

195-
static void *__console_get_cursor_start_ptr()
195+
static inline void *__console_get_cursor_start_ptr()
196196
{
197197
PrintConsole *con;
198198
if( !(con = currentConsole) )

0 commit comments

Comments
 (0)