summaryrefslogtreecommitdiff
path: root/src/arch/immediate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/immediate.c')
-rw-r--r--src/arch/immediate.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/src/arch/immediate.c b/src/arch/immediate.c
index 19c86b2..4f94be3 100644
--- a/src/arch/immediate.c
+++ b/src/arch/immediate.c
@@ -359,7 +359,7 @@ bool g_imm_operand_does_padding(const GImmOperand *operand)
/******************************************************************************
* *
-* Paramètres : operand = structure dont le contenu est à définir. *
+* Paramètres : operand = structure dont le contenu est à consulter. *
* *
* Description : Indique le signe d'une valeur immédiate. *
* *
@@ -402,6 +402,64 @@ bool g_imm_operand_is_negative(const GImmOperand *operand)
/******************************************************************************
* *
+* Paramètres : operand = structure dont le contenu est à consulter. *
+* *
+* Description : Indique si une valeur immédiate est nulle ou non. *
+* *
+* Retour : true si la valeur est nulle, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_imm_operand_is_null(const GImmOperand *operand)
+{
+ bool result; /* Bilan à renvoyer */
+
+ switch (operand->size)
+ {
+ case MDS_4_BITS_SIGNED:
+ result = !(operand->signed_imm.val8 & 0x0f);
+ break;
+ case MDS_4_BITS_UNSIGNED:
+ result = !(operand->unsigned_imm.val8 & 0x0f);
+ break;
+ case MDS_8_BITS_SIGNED:
+ result = !(operand->signed_imm.val8 & 0xff);
+ break;
+ case MDS_8_BITS_UNSIGNED:
+ result = !(operand->unsigned_imm.val8 & 0xff);
+ break;
+ case MDS_16_BITS_SIGNED:
+ result = !(operand->signed_imm.val16 & 0xffff);
+ break;
+ case MDS_16_BITS_UNSIGNED:
+ result = !(operand->unsigned_imm.val16 & 0xffff);
+ break;
+ case MDS_32_BITS_SIGNED:
+ result = !(operand->signed_imm.val32 & 0xffffffff);
+ break;
+ case MDS_32_BITS_UNSIGNED:
+ result = !(operand->unsigned_imm.val32 & 0xffffffff);
+ break;
+ case MDS_64_BITS_SIGNED:
+ result = !(operand->signed_imm.val64 & 0xffffffffffffffffll);
+ break;
+ case MDS_64_BITS_UNSIGNED:
+ result = !(operand->unsigned_imm.val64 & 0xffffffffffffffffll);
+ break;
+ default:
+ result = false;
+ break;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : operand = opérande à transcrire. *
* syntax = type de représentation demandée. *
* value = valeur portée par l'opérande transcrite. [OUT] *