<commit_before>package com.ninty.cmd;

import com.ninty.cmd.base.BranchCmd;
import com.ninty.cmd.base.NoOperandCmd;
import com.ninty.runtime.NiFrame;
import com.ninty.runtime.OperandStack;

/**
 * Created by ninty on 2017/7/16.
 */
public class CmdComparisons {

    private static int icmp(NiFrame frame) {
        OperandStack stack = frame.getOperandStack();
        int num1 = stack.popInt();
        int num2 = stack.popInt();
        return num1 > num2 ? 1 : (num1 == num2 ? 0 : -1);
    }

    private static boolean acmp(NiFrame frame) {
        OperandStack stack = frame.getOperandStack();
        Object ref1 = stack.popRef();
        Object ref2 = stack.popRef();
        return ref1 == ref2;
    }

    private static void fcmp(NiFrame frame, int ifNaN) {
        OperandStack stack = frame.getOperandStack();
        float num1 = stack.popFloat();
        float num2 = stack.popFloat();
        if (Float.isNaN(num1) || Float.isNaN(num2)) {
            stack.pushInt(ifNaN);
        } else {
            stack.pushInt(num1 > num2 ? 1 : (num1 == num2 ? 0 : -1));
        }
    }

    private static void dcmp(NiFrame frame, int ifNaN) {
        OperandStack stack = frame.getOperandStack();
        double num1 = stack.popDouble();
        double num2 = stack.popDouble();
        if (Double.isNaN(num1) || Double.isNaN(num2)) {
            stack.pushInt(ifNaN);
        } else {
            stack.pushInt(num1 > num2 ? 1 : (num1 == num2 ? 0 : -1));
        }
    }

    public static class LCMP extends NoOperandCmd {
        @Override
        public void exec(NiFrame frame) {
            OperandStack stack = frame.getOperandStack();
            long num1 = stack.popLong();
            long num2 = stack.popLong();
            stack.pushInt(num1 > num2 ? 1 : (num1 == num2 ? 0 : -1));
        }
    }

    public static class FCMPL extends NoOperandCmd {
        @Override
        public void exec(NiFrame frame) {
            fcmp(frame, -1);<commit_msg>num2 - num1 for CMP<commit_after>package com.ninty.cmd;

import com.ninty.cmd.base.BranchCmd;
import com.ninty.cmd.base.NoOperandCmd;
import com.ninty.runtime.NiFrame;
import com.ninty.runtime.OperandStack;

/**
 * Created by ninty on 2017/7/16.
 */
public class CmdComparisons {

    private static int icmp(NiFrame frame) {
        OperandStack stack = frame.getOperandStack();
        int num2 = stack.popInt();
        int num1 = stack.popInt();
        return num1 > num2 ? 1 : (num1 == num2 ? 0 : -1);
    }

    private static boolean acmp(NiFrame frame) {
        OperandStack stack = frame.getOperandStack();
        Object ref2 = stack.popRef();
        Object ref1 = stack.popRef();
        return ref1 == ref2;
    }

    private static void fcmp(NiFrame frame, int ifNaN) {
        OperandStack stack = frame.getOperandStack();
        float num2 = stack.popFloat();
        float num1 = stack.popFloat();
        if (Float.isNaN(num1) || Float.isNaN(num2)) {
            stack.pushInt(ifNaN);
        } else {
            stack.pushInt(num1 > num2 ? 1 : (num1 == num2 ? 0 : -1));
        }
    }

    private static void dcmp(NiFrame frame, int ifNaN) {
        OperandStack stack = frame.getOperandStack();
        double num2 = stack.popDouble();
        double num1 = stack.popDouble();
        if (Double.isNaN(num1) || Double.isNaN(num2)) {
            stack.pushInt(ifNaN);
        } else {
            stack.pushInt(num1 > num2 ? 1 : (num1 == num2 ? 0 : -1));
        }
    }

    public static class LCMP extends NoOperandCmd {
        @Override
        public void exec(NiFrame frame) {
            OperandStack stack = frame.getOperandStack();
            long num2 = stack.popLong();
            long num1 = stack.popLong();
            stack.pushInt(num1 > num2 ? 1 : (num1 == num2 ? 0 : -1));
        }
    }

    public static class FCMPL extends NoOperandCmd {
        @Override
        public void exec(NiFrame frame) {
            fcmp(frame, -1);
{'fraction_non_alphanumeric': 0.11974683544303798, 'fraction_numerical': 0.026835443037974683, 'mean_word_length': 2.1110236220472443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6030716', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1253, 'n_words': 308}