Permalink
Browse files

Turned FribidiBracketType into a simple UINT32 instead of a struct.

  • Loading branch information...
dov committed Nov 14, 2017
1 parent a6fee5e commit 0e273c103dd059f6d4e87182189d5cc37d996e00
Showing with 20 additions and 22 deletions.
  1. +7 −7 lib/fribidi-bidi.c
  2. +4 −3 lib/fribidi-brackets.c
  3. +4 −2 lib/fribidi-brackets.h
  4. +2 −2 lib/fribidi-run.c
  5. +3 −8 lib/fribidi-types.h
View
@@ -102,8 +102,8 @@ compact_list (
for_run_list (list, list)
if (RL_TYPE (list->prev) == RL_TYPE (list)
&& RL_LEVEL (list->prev) == RL_LEVEL (list)
&& RL_BRACKET_TYPE(list).bracket_id == 0 /* Don't join brackets! */
&& RL_BRACKET_TYPE(list->prev).bracket_id == 0
&& RL_BRACKET_TYPE(list) == FRIBIDI_NO_BRACKET /* Don't join brackets! */
&& RL_BRACKET_TYPE(list->prev) == FRIBIDI_NO_BRACKET
)
list = merge_with_prev (list);
}
@@ -124,8 +124,8 @@ compact_neutrals (
((RL_TYPE (list->prev) == RL_TYPE (list)
|| (FRIBIDI_IS_NEUTRAL (RL_TYPE (list->prev))
&& FRIBIDI_IS_NEUTRAL (RL_TYPE (list)))))
&& RL_BRACKET_TYPE(list).bracket_id == 0 /* Don't join brackets! */
&& RL_BRACKET_TYPE(list->prev).bracket_id == 0
&& RL_BRACKET_TYPE(list) == FRIBIDI_NO_BRACKET /* Don't join brackets! */
&& RL_BRACKET_TYPE(list->prev) == FRIBIDI_NO_BRACKET
)
list = merge_with_prev (list);
}
@@ -1060,9 +1060,9 @@ fribidi_get_par_embedding_levels_ex (
bracket_stack[iso_level] = fribidi_malloc (sizeof (bracket_stack[0])
* FRIBIDI_BIDI_MAX_NESTED_BRACKET_PAIRS);
FriBidiBracketType brack_prop = RL_BRACKET_TYPE(pp);
if (FRIBIDI_IS_BRACKET(&brack_prop))
if (brack_prop!= FRIBIDI_NO_BRACKET)
{
if (brack_prop.is_open)
if (FRIBIDI_IS_BRACKET_OPEN(brack_prop))
{
if (bracket_stack_size[iso_level]==FRIBIDI_BIDI_MAX_NESTED_BRACKET_PAIRS)
break;
@@ -1076,7 +1076,7 @@ fribidi_get_par_embedding_levels_ex (
while (stack_idx >= 0)
{
FriBidiBracketType se_brack_prop = RL_BRACKET_TYPE(bracket_stack[iso_level][stack_idx]);
if (se_brack_prop.bracket_id == brack_prop.bracket_id)
if (FRIBIDI_BRACKET_ID(se_brack_prop) == FRIBIDI_BRACKET_ID(brack_prop))
{
bracket_stack_size[iso_level] = stack_idx;
View
@@ -60,13 +60,14 @@ fribidi_get_bracket (
fribidi_boolean is_open = false;
if (char_type == 0)
bracket_type.bracket_id = 0;
bracket_type = FRIBIDI_NO_BRACKET;
else
{
is_open = (char_type & FRIBIDI_TYPE_BRACKET_OPEN) != 0;
bracket_type.bracket_id = FRIBIDI_GET_BRACKETS (ch);
bracket_type = FRIBIDI_GET_BRACKETS (ch) & FRIBIDI_BRACKET_ID_MASK;
}
bracket_type.is_open = is_open;
if (is_open)
bracket_type |= FRIBIDI_BRACKET_OPEN_MASK;
return bracket_type;
}
View
@@ -73,8 +73,10 @@ fribidi_get_bracket_types (
FriBidiBracketType *btypes
);
#define FRIBIDI_IS_BRACKET(bt) ((bt)->bracket_id>0)
#define FRIBIDI_IS_BRACKET_OPEN(bt) ((bt)->is_open>0)
#define FRIBIDI_BRACKET_OPEN_MASK 0x80000000
#define FRIBIDI_BRACKET_ID_MASK 0x7fffffff
#define FRIBIDI_IS_BRACKET_OPEN(bt) ((bt & FRIBIDI_BRACKET_OPEN_MASK)>0)
#define FRIBIDI_BRACKET_ID(bt) ((bt & FRIBIDI_BRACKET_ID_MASK))
#include "fribidi-enddecls.h"
View
@@ -137,8 +137,8 @@ run_list_encode_bidi_types (
bracket_type = bracket_types[i];
if (char_type != last->type
|| bracket_type.bracket_id > 0 /* Always separate bracket into single char runs! */
|| last->bracket_type.bracket_id > 0
|| bracket_type != FRIBIDI_NO_BRACKET /* Always separate bracket into single char runs! */
|| last->bracket_type != FRIBIDI_NO_BRACKET
|| FRIBIDI_IS_ISOLATE(char_type)
)
{
View
@@ -115,16 +115,11 @@ typedef FRIBIDI_BOOLEAN fribidi_boolean;
typedef FRIBIDI_UNICHAR FriBidiChar;
typedef FRIBIDI_STR_INDEX FriBidiStrIndex;
struct _FriBracketTypeStruct {
FriBidiChar bracket_id;
fribidi_boolean is_open;
};
typedef struct _FriBracketTypeStruct FriBidiBracketType;
/* The MSB is used to indicate an opening bracket */
typedef FriBidiChar FriBidiBracketType;
/* Use FRIBIDI_NO_BRACKET for assigning to a non-bracket */
#define FRIBIDI_NO_BRACKET { 0, 0 }
#define FRIBIDI_NO_BRACKET 0
/* A few macros for working with bits */

0 comments on commit 0e273c1

Please sign in to comment.