@@ -3523,6 +3523,113 @@ void variable_add_inplace_mt( Environment * _environment, char * _source, char *
3523
3523
3524
3524
}
3525
3525
3526
+ void variable_xor_inplace ( Environment * _environment , char * _source , int _destination ) {
3527
+
3528
+ if ( _destination ) {
3529
+
3530
+ Variable * source = variable_retrieve ( _environment , _source );
3531
+
3532
+ switch ( VT_BITWIDTH ( source -> type ) ) {
3533
+ case 32 :
3534
+ cpu_xor_32bit_const ( _environment , source -> realName , _destination , source -> realName );
3535
+ break ;
3536
+ case 16 :
3537
+ cpu_xor_16bit_const ( _environment , source -> realName , _destination , source -> realName );
3538
+ break ;
3539
+ case 8 :
3540
+ cpu_xor_8bit_const ( _environment , source -> realName , _destination , source -> realName );
3541
+ break ;
3542
+ case 1 :
3543
+ case 0 :
3544
+ CRITICAL_XOR_INPLACE_UNSUPPORTED ( _source , DATATYPE_AS_STRING [source -> type ]);
3545
+ }
3546
+
3547
+ }
3548
+ }
3549
+
3550
+ /**
3551
+ * @brief Add two variable and return the sum of them on the first
3552
+ *
3553
+ * This function allows you to sum the value of two variables. Note
3554
+ * that both variables must pre-exist before the operation,
3555
+ * under penalty of an exception.
3556
+ *
3557
+ * @pre _source and _destination variables must exist
3558
+ *
3559
+ * @param _environment Current calling environment
3560
+ * @param _source Source variable's name and destination of sum
3561
+ * @param _destination Value to sum
3562
+ * @throw EXIT_FAILURE "Destination variable does not cast"
3563
+ * @throw EXIT_FAILURE "Source variable does not exist"
3564
+ */
3565
+ void variable_xor_inplace_vars ( Environment * _environment , char * _source , char * _destination ) {
3566
+
3567
+ Variable * source = variable_retrieve ( _environment , _source );
3568
+ Variable * target = variable_retrieve ( _environment , _destination );
3569
+
3570
+ if ( source -> type != target -> type ) {
3571
+ target = variable_cast ( _environment , _destination , source -> type );
3572
+ if ( ! target ) {
3573
+ CRITICAL_VARIABLE (_destination );
3574
+ }
3575
+ }
3576
+
3577
+ switch ( VT_BITWIDTH ( source -> type ) ) {
3578
+ case 32 :
3579
+ cpu_xor_32bit ( _environment , source -> realName , target -> realName , source -> realName );
3580
+ break ;
3581
+ case 16 :
3582
+ cpu_xor_16bit ( _environment , source -> realName , target -> realName , source -> realName );
3583
+ break ;
3584
+ case 8 :
3585
+ cpu_xor_8bit ( _environment , source -> realName , target -> realName , source -> realName );
3586
+ break ;
3587
+ case 1 :
3588
+ case 0 :
3589
+ CRITICAL_XOR_INPLACE_UNSUPPORTED ( _source , DATATYPE_AS_STRING [source -> type ]);
3590
+ }
3591
+
3592
+ }
3593
+
3594
+ /**
3595
+ * @brief Add two variable and return the sum of them on the first
3596
+ *
3597
+ * This function allows you to sum the value of two variables. Note
3598
+ * that both variables must pre-exist before the operation,
3599
+ * under penalty of an exception.
3600
+ *
3601
+ * @pre _source and _destination variables must exist
3602
+ *
3603
+ * @param _environment Current calling environment
3604
+ * @param _source Source variable's name and destination of sum
3605
+ * @param _destination Value to sum
3606
+ * @throw EXIT_FAILURE "Destination variable does not cast"
3607
+ * @throw EXIT_FAILURE "Source variable does not exist"
3608
+ */
3609
+ void variable_xor_inplace_mt ( Environment * _environment , char * _source , char * _destination ) {
3610
+
3611
+ parser_array_init ( _environment );
3612
+ parser_array_index_symbolic ( _environment , "PROTOTHREADCT" );
3613
+ Variable * array = variable_retrieve ( _environment , _source );
3614
+ if ( array -> type != VT_TARRAY ) {
3615
+ CRITICAL_NOT_ARRAY ( _source );
3616
+ }
3617
+ Variable * value = variable_move_from_array ( _environment , array -> name );
3618
+ parser_array_cleanup ( _environment );
3619
+
3620
+ variable_xor_inplace_vars ( _environment , value -> name , _destination );
3621
+
3622
+ parser_array_init ( _environment );
3623
+ parser_array_index_symbolic ( _environment , "PROTOTHREADCT" );
3624
+ array = variable_retrieve ( _environment , _source );
3625
+ if ( array -> type != VT_TARRAY ) {
3626
+ CRITICAL_NOT_ARRAY ( _source );
3627
+ }
3628
+ variable_move_array ( _environment , array -> name , value -> name );
3629
+ parser_array_cleanup ( _environment );
3630
+
3631
+ }
3632
+
3526
3633
/**
3527
3634
* @brief Make a differenze between two variable and return the difference of them
3528
3635
*
@@ -8075,7 +8182,7 @@ Variable * variable_move_from_array_byte( Environment * _environment, Variable *
8075
8182
}
8076
8183
8077
8184
cpu_move_8bit ( _environment , precalculatedOffset -> realName , result -> realName );
8078
-
8185
+
8079
8186
return result ;
8080
8187
}
8081
8188
}
0 commit comments