Re: [hackers] [st] reduce size of each glyph for faster copy. || Aurélien Aptel

From: pancake <pancake_AT_youterm.com>
Date: Mon, 13 Feb 2012 07:16:40 +0100

the size of the struct is the same. sizeof char == sizeof int because of alignment. use packed data attribute or uchar[4]. for performance .. its faster to write/read on 4 aligned bytes than 1 unaligned byte

On Feb 13, 2012, at 1:15, hg_AT_suckless.org wrote:

> changeset: 230:ffdf9d0f711d
> parent: 228:9550074991e1
> user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
> date: Wed Feb 08 16:45:52 2012 +0100
> files: st.c
> description:
> reduce size of each glyph for faster copy.
>
>
> diff -r 9550074991e1 -r ffdf9d0f711d st.c
> --- a/st.c Tue Feb 07 23:53:45 2012 +0100
> +++ b/st.c Wed Feb 08 16:45:52 2012 +0100
> _AT_@ -86,10 +86,10 @@
>
> typedef struct {
> char c[UTF_SIZ]; /* character code */
> - char mode; /* attribute flags */
> - int fg; /* foreground */
> - int bg; /* background */
> - char state; /* state flags */
> + uchar mode; /* attribute flags */
> + uchar fg; /* foreground */
> + uchar bg; /* background */
> + uchar state; /* state flags */
> } Glyph;
>
> typedef Glyph* Line;
>
>
Received on Mon Feb 13 2012 - 07:16:40 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 13 2012 - 07:24:05 CET