From: bernie Date: Mon, 13 Mar 2006 02:05:54 +0000 (+0000) Subject: Mark slow paths as UNLIKELY. X-Git-Tag: 1.0.0~680 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=42b50d5905e886d792cd1a338c446ac43f61d6cf;p=bertos.git Mark slow paths as UNLIKELY. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@561 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/gfx/text.c b/gfx/text.c index 9c96c983..95478343 100755 --- a/gfx/text.c +++ b/gfx/text.c @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.6 2006/03/13 02:05:54 bernie + *#* Mark slow paths as UNLIKELY. + *#* *#* Revision 1.5 2006/03/07 22:18:04 bernie *#* Correctly compute text width for prop fonts; Make styles a per-bitmap attribute. *#* @@ -135,10 +138,10 @@ static int text_putglyph(char c, struct Bitmap *bm) unsigned char index = (unsigned char)c; /* Check for out of range char and replace with '?' or first char in font. */ - if (index < bm->font->first || index > bm->font->last) + if (UNLIKELY(!FONT_HAS_GLYPH(bm->font, index))) { kprintf("Illegal char '%c' (0x%02x)\n", index, index); - if ('?' >= bm->font->first && '?' <= bm->font->last) + if (FONT_HAS_GLYPH(bm->font, '?')) index = '?'; else index = bm->font->first; @@ -172,7 +175,7 @@ static int text_putglyph(char c, struct Bitmap *bm) } /* Slow path for styled glyphs */ - if (bm->styles) + if (UNLIKELY(bm->styles)) { uint8_t prev_dots = 0, italic_prev_dots = 0; uint8_t dots; @@ -258,7 +261,7 @@ static int text_putglyph(char c, struct Bitmap *bm) int text_putchar(char c, struct Bitmap *bm) { /* Handle ANSI escape sequences */ - if (ansi_mode) + if (UNLIKELY(ansi_mode)) { switch (c) { @@ -309,9 +312,10 @@ void text_clearLine(struct Bitmap *bm, int line) } -/*! +/** * Set/clear algorithmic font style bits. * + * \param bm Pointer to Bitmap to affect. * \param flags Style flags to set * \param mask Mask of flags to modify * \return Old style flags diff --git a/gfx/text_format.c b/gfx/text_format.c index e1452d8a..1b0e8a34 100755 --- a/gfx/text_format.c +++ b/gfx/text_format.c @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.6 2006/03/13 02:05:54 bernie + *#* Mark slow paths as UNLIKELY. + *#* *#* Revision 1.5 2006/03/07 22:18:04 bernie *#* Correctly compute text width for prop fonts; Make styles a per-bitmap attribute. *#* @@ -219,7 +222,7 @@ static int text_charWidth(int c, struct TextWidthData *twd) coord_t glyph_width; - if (index < bm->font->first || index > bm->font->last) + if (UNLIKELY(index < bm->font->first || index > bm->font->last)) { if ('?' >= bm->font->first && '?' <= bm->font->last) index = '?';