Java Integer Clamp CLAMPED_Wr(long ITERW, int FBZCP)

Here you can find the source of CLAMPED_Wr(long ITERW, int FBZCP)

Description

CLAMPE Wr

License

Open Source License

Declaration

static int CLAMPED_Wr(long ITERW, int FBZCP) 

Method Source Code

//package com.java2s;
// I ported this from the mame project, this is their license

public class Main {
    static int CLAMPED_Wr(long ITERW, int FBZCP) {
        int RESULT = (short) ((ITERW) >> 32);
        if (!FBZCP_RGBZW_CLAMP(FBZCP)) {
            RESULT &= 0xffff;//ww w  .j  a  v  a2s  . c om
            if (RESULT == 0xffff)
                RESULT = 0;
            else if (RESULT == 0x100)
                RESULT = 0xff;
            RESULT &= 0xff;
            return RESULT;
        } else {
            return CLAMPr(RESULT, 0, 0xff);
        }
    }

    static boolean FBZCP_RGBZW_CLAMP(int val) {
        return (((val) >> 28) & 1) != 0;
    }

    static int CLAMPr(int val, int min, int max) {
        if (val < min) {
            val = min;
        } else if (val > max) {
            val = max;
        }
        return val;
    }
}

Related

  1. clamp_wrap(int a, int x, int y)
  2. clampAngle(int angle)
  3. clampByte(int in)
  4. clampColor(int c)
  5. clampColorInt(int color)
  6. clampI(int a, int min, int max)
  7. clampInt(final int min, final int max, final int value)
  8. clampInt(final int min, final int value, final int max)
  9. clampInt(int value, int min, int max)