[vte] [ring] Optimize attribute bitfield placement



commit c00499dd53ef5ee43ec39fa5823ffcb0659b51e6
Author: Behdad Esfahbod <behdad behdad org>
Date:   Tue Sep 8 01:25:40 2009 -0400

    [ring] Optimize attribute bitfield placement

 src/ring.c |    6 +++---
 src/ring.h |    9 ++++++---
 2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/ring.c b/src/ring.c
index 94d9e05..029ca25 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -212,7 +212,7 @@ _vte_cell_array_free (VteCell *cells)
  */
 
 static guint
-_width_bytes (guint x)
+_width (guint x)
 {
 	if (!x)
 		return 0;
@@ -241,8 +241,8 @@ _vte_row_storage_compute (const VteCell *cells, guint len)
 
 	storage.compact = 0;
 	storage.flags.compact = 1;
-	storage.flags.charbytes = _width_bytes (chars);
-	storage.flags.attrbytes = _width_bytes (attrs);
+	storage.flags.charbytes = _width (chars);
+	storage.flags.attrbytes = _width (attrs);
 
 	return storage;
 }
diff --git a/src/ring.h b/src/ring.h
index 5250860..ca2937e 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -44,6 +44,9 @@ G_BEGIN_DECLS
 
 /*
  * vtecellattr: A single cell style attributes
+ *
+ * Ordered by most commonly changed attributes, to
+ * optimize the compact representation.
  */
 
 typedef struct _vtecellattr {
@@ -52,17 +55,17 @@ typedef struct _vtecellattr {
 				   Also abused for tabs; bug 353610
 				   Keep at least 4 for tabs to work
 				   */
+	guint32 bold: 1;
 	guint32 fore: 9;	/* Index into color palette */
 	guint32 back: 9;	/* Index into color palette. */
 
-	guint32 standout: 1;	/* Single-bit attributes. */
+	guint32 standout: 1;
 	guint32 underline: 1;
 	guint32 strikethrough: 1;
 
 	guint32 reverse: 1;
 	guint32 blink: 1;
 	guint32 half: 1;
-	guint32 bold: 1;
 
 	guint32 invisible: 1;
 	/* unused; bug 499893
@@ -97,6 +100,7 @@ static const VteCellInt basic_cell = {
 		0,
 		{
 			1, /* columns */
+			0, /* bold */
 			VTE_DEF_FG, /* fore */
 			VTE_DEF_BG, /* back */
 
@@ -107,7 +111,6 @@ static const VteCellInt basic_cell = {
 			0, /* reverse */
 			0, /* blink */
 			0, /* half */
-			0, /* bold */
 
 			0  /* invisible */
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]