2 * Regular Pattern Analyzer (RPA)
3 * Copyright (c) 2009-2010 Martin Stoilov
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * Martin Stoilov <martin@rpasearch.com>
21 #include "rvm/rvmoperator.h"
22 #include "rvm/rvmreg.h"
25 void rvm_op_noteq_unsigned(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, ruword op1, ruword op2)
29 r = (op1 != op2) ? 1 : 0;
31 RVM_REG_SETTYPE(res, RVM_DTYPE_BOOLEAN);
32 RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
36 void rvm_op_noteq_signed(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, rword op1, rword op2)
40 r = (op1 != op2) ? 1 : 0;
42 RVM_REG_SETTYPE(res, RVM_DTYPE_BOOLEAN);
43 RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
47 void rvm_op_noteq_double(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, double op1, double op2)
51 r = (op1 != op2) ? 1 : 0;
53 RVM_REG_SETTYPE(res, RVM_DTYPE_BOOLEAN);
54 RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);
58 void rvm_op_noteq_string_string(rvmcpu_t *cpu, ruint16 opid, rvmreg_t *res, const rvmreg_t *arg1, const rvmreg_t *arg2)
61 rstring_t *s1 = (rstring_t *)RVM_REG_GETP(arg1);
62 rstring_t *s2 = (rstring_t *)RVM_REG_GETP(arg2);
64 r = (s1->s.size == s2->s.size && r_strncmp(s1->s.str, s2->s.str, s1->s.size) == 0) ? 0 : 1;
65 rvm_reg_setboolean(res, r);
66 RVM_STATUS_UPDATE(cpu, RVM_STATUS_Z, !r);