Sha256: 34773adff28a6a97dcf8bf6ababbfe6e5db961a2d15c784e5768e93d58e3f5fa

Contents?: true

Size: 454 Bytes

Versions: 8

Compression:

Stored size: 454 Bytes

Contents

#include "psd_native_ext.h"

VALUE psd_native_util_pad2(VALUE self, VALUE i) {
  return INT2FIX((FIX2INT(i) + 1) & ~0x01);
}

VALUE psd_native_util_pad4(VALUE self, VALUE i) {
  return INT2FIX(((FIX2INT(i) + 4) & ~0x03) - 1);
}

VALUE psd_native_util_clamp(VALUE self, VALUE r_num, VALUE r_min, VALUE r_max) {
  int num = FIX2INT(r_num);
  int min = FIX2INT(r_min);
  int max = FIX2INT(r_max);

  return num > max ? r_max : (num < min ? r_min : r_num);
}

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
bench9000-0.1 vendor/psd_native/ext/psd_native/util.c
psd_native-1.1.3 ext/psd_native/util.c
psd_native-1.1.2 ext/psd_native/util.c
psd_native-1.1.1 ext/psd_native/util.c
psd_native-1.1.0 ext/psd_native/util.c
psd_native-1.0.1 ext/psd_native/util.c
psd_native-1.0.0 ext/psd_native/util.c
psd_native-0.6.0 ext/psd_native/util.c