diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-08-10 21:55:57 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-08-10 21:55:57 (GMT) |
commit | 35f435585638fdf74377c3a9c7e7c2413995d4a7 (patch) | |
tree | 38835ce0b13a54c7e8484aaa10ad8536f3760c5c /plugins/dalvik/operands/pool.c | |
parent | c0cc928bfab0af2cdbf16e9a04d41983f4732b93 (diff) |
Prepare all Dalvik operands for a singleton status.
Diffstat (limited to 'plugins/dalvik/operands/pool.c')
-rw-r--r-- | plugins/dalvik/operands/pool.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/plugins/dalvik/operands/pool.c b/plugins/dalvik/operands/pool.c index 89bee99..baab1f6 100644 --- a/plugins/dalvik/operands/pool.c +++ b/plugins/dalvik/operands/pool.c @@ -82,6 +82,14 @@ static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *, GBufferLine +/* ------------------------ CONTROLE DU VOLUME DES INSTANCES ------------------------ */ + + +/* Fournit l'empreinte d'un candidat à une centralisation. */ +static guint g_dalvik_pool_operand_hash(const GDalvikPoolOperand *); + + + /* --------------------- TRANSPOSITIONS VIA CACHE DES OPERANDES --------------------- */ @@ -133,6 +141,8 @@ static void g_dalvik_pool_operand_class_init(GDalvikPoolOperandClass *klass) operand->compare = (operand_compare_fc)g_dalvik_pool_operand_compare; operand->print = (operand_print_fc)g_dalvik_pool_operand_print; + operand->hash = (operand_hash_fc)g_dalvik_pool_operand_hash; + operand->unserialize = (unserialize_operand_fc)g_dalvik_pool_operand_unserialize; operand->serialize = (serialize_operand_fc)g_dalvik_pool_operand_serialize; @@ -530,6 +540,49 @@ uint32_t g_dalvik_pool_operand_get_index(const GDalvikPoolOperand *operand) /* ---------------------------------------------------------------------------------- */ +/* CONTROLE DU VOLUME DES INSTANCES */ +/* ---------------------------------------------------------------------------------- */ + + +/****************************************************************************** +* * +* Paramètres : operand = objet dont l'instance se veut unique. * +* * +* Description : Fournit l'empreinte d'un candidat à une centralisation. * +* * +* Retour : Empreinte de l'élément représenté. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static guint g_dalvik_pool_operand_hash(const GDalvikPoolOperand *operand) +{ + guint result; /* Valeur à retourner */ + DalvikPoolType type; /* Type porté par l'opérande */ + uint32_t index; /* Indice de l'élément */ + + result = (unsigned int)(unsigned long)operand->format; + +#if __SIZEOF_INT__ != __SIZEOF_LONG__ + result ^= ((unsigned long)operand->format) >> 32; +#endif + + type = g_dalvik_pool_operand_get_pool_type(operand); + + result ^= type; + + index = g_dalvik_pool_operand_get_index(operand); + + result ^= index; + + return result; + +} + + + +/* ---------------------------------------------------------------------------------- */ /* TRANSPOSITIONS VIA CACHE DES OPERANDES */ /* ---------------------------------------------------------------------------------- */ |