Class: Int16
- Inherits:
-
JAVA::Value
- Object
- JAVA::Value
- Int16
- Defined in:
- ext/primitive/primitive.c
Class Method Summary collapse
Instance Method Summary collapse
- #!=(o) ⇒ Object
- #%(o) ⇒ Object
- #&(o) ⇒ Object
- #*(o) ⇒ Object
- #+(o) ⇒ Object
- #+@ ⇒ Object
- #-(o) ⇒ Object
- #-@ ⇒ Object
- #/(o) ⇒ Object
- #<(o) ⇒ Object
- #<<(o) ⇒ Object
- #<=(o) ⇒ Object
- #<=>(o) ⇒ Object
- #==(o) ⇒ Object
- #===(o) ⇒ Object
- #>(o) ⇒ Object
- #>=(o) ⇒ Object
- #>>(o) ⇒ Object
- #^(o) ⇒ Object
- #eql?(o) ⇒ Boolean
- #equals(o) ⇒ Object
- #hash ⇒ Object
- #hashCode ⇒ Object
- #inspect ⇒ Object
- #to_byte ⇒ Object
- #to_char ⇒ Object
- #to_f ⇒ Object
- #to_float32 ⇒ Object
- #to_float64 ⇒ Object
- #to_i ⇒ Object
- #to_int ⇒ Object
- #to_int16 ⇒ Object
- #to_int32 ⇒ Object
- #to_int64 ⇒ Object
- #to_s ⇒ Object
- #toString ⇒ Object
- #ushr(o) ⇒ Object
- #|(o) ⇒ Object
- #~ ⇒ Object
Methods inherited from JAVA::Value
Class Method Details
.[](o) ⇒ Object
1092 1093 1094 1095 1096 1097 |
# File 'ext/primitive/primitive.c', line 1092
static VALUE
r_Int16_new(VALUE self, VALUE o)
{
int16_t value = __accept_int16(o);
return __allocate_Int16(value);
}
|
Instance Method Details
#!=(o) ⇒ Object
1210 1211 1212 1213 1214 1215 1216 1217 |
# File 'ext/primitive/primitive.c', line 1210
static VALUE
r_Int16_ne(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return p->value != v ? Qtrue : Qfalse;
}
|
#%(o) ⇒ Object
1248 1249 1250 1251 1252 1253 1254 1255 |
# File 'ext/primitive/primitive.c', line 1248
static VALUE
r_Int16_mod(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return __allocate_Int32(__mod_int32(p->value, v));
}
|
#&(o) ⇒ Object
1348 1349 1350 1351 1352 1353 1354 1355 |
# File 'ext/primitive/primitive.c', line 1348
static VALUE
r_Int16_and(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return __allocate_Int32(p->value & v);
}
|
#*(o) ⇒ Object
1232 1233 1234 1235 1236 1237 1238 1239 |
# File 'ext/primitive/primitive.c', line 1232
static VALUE
r_Int16_mul(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return __allocate_Int32(p->value * v);
}
|
#+(o) ⇒ Object
1256 1257 1258 1259 1260 1261 1262 1263 |
# File 'ext/primitive/primitive.c', line 1256
static VALUE
r_Int16_add(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return __allocate_Int32(p->value + v);
}
|
#+@ ⇒ Object
1218 1219 1220 1221 1222 1223 1224 |
# File 'ext/primitive/primitive.c', line 1218
static VALUE
r_Int16_pos(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __allocate_Int32(+p->value);
}
|
#-(o) ⇒ Object
1264 1265 1266 1267 1268 1269 1270 1271 |
# File 'ext/primitive/primitive.c', line 1264
static VALUE
r_Int16_sub(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return __allocate_Int32(p->value - v);
}
|
#-@ ⇒ Object
1225 1226 1227 1228 1229 1230 1231 |
# File 'ext/primitive/primitive.c', line 1225
static VALUE
r_Int16_neg(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __allocate_Int32(-p->value);
}
|
#/(o) ⇒ Object
1240 1241 1242 1243 1244 1245 1246 1247 |
# File 'ext/primitive/primitive.c', line 1240
static VALUE
r_Int16_div(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return __allocate_Int32(__div_int32(p->value, v));
}
|
#<(o) ⇒ Object
1284 1285 1286 1287 1288 1289 1290 1291 |
# File 'ext/primitive/primitive.c', line 1284
static VALUE
r_Int16_lt(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return p->value < v ? Qtrue : Qfalse;
}
|
#<<(o) ⇒ Object
1323 1324 1325 1326 1327 1328 1329 1330 |
# File 'ext/primitive/primitive.c', line 1323
static VALUE
r_Int16_shl(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t d = __accept_int32(o);
return __allocate_Int32(p->value << d);
}
|
#<=(o) ⇒ Object
1292 1293 1294 1295 1296 1297 1298 1299 |
# File 'ext/primitive/primitive.c', line 1292
static VALUE
r_Int16_le(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return p->value <= v ? Qtrue : Qfalse;
}
|
#<=>(o) ⇒ Object
1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 |
# File 'ext/primitive/primitive.c', line 1272
static VALUE
r_Int16_cmp(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
if (p->value < v)
return r_INT32_M1;
if (p->value > v)
return r_INT32_1;
return r_INT32_0;
}
|
#==(o) ⇒ Object
1202 1203 1204 1205 1206 1207 1208 1209 |
# File 'ext/primitive/primitive.c', line 1202
static VALUE
r_Int16_eq(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return p->value == v ? Qtrue : Qfalse;
}
|
#===(o) ⇒ Object
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 |
# File 'ext/primitive/primitive.c', line 1098
static VALUE
r_Int16_equals(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
if (TYPE(o) == T_DATA) {
if (RBASIC(o)->klass == r_Int16) {
Int16 *op;
Data_Get_Struct(o, Int16, op);
if (p->value == op->value)
return Qtrue;
}
}
return Qfalse;
}
|
#>(o) ⇒ Object
1308 1309 1310 1311 1312 1313 1314 1315 |
# File 'ext/primitive/primitive.c', line 1308
static VALUE
r_Int16_gt(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return p->value > v ? Qtrue : Qfalse;
}
|
#>=(o) ⇒ Object
1300 1301 1302 1303 1304 1305 1306 1307 |
# File 'ext/primitive/primitive.c', line 1300
static VALUE
r_Int16_ge(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return p->value >= v ? Qtrue : Qfalse;
}
|
#>>(o) ⇒ Object
1331 1332 1333 1334 1335 1336 1337 1338 |
# File 'ext/primitive/primitive.c', line 1331
static VALUE
r_Int16_shr(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t d = __accept_int32(o);
return __allocate_Int32(p->value >> d);
}
|
#^(o) ⇒ Object
1356 1357 1358 1359 1360 1361 1362 1363 |
# File 'ext/primitive/primitive.c', line 1356
static VALUE
r_Int16_xor(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return __allocate_Int32(p->value ^ v);
}
|
#eql?(o) ⇒ Boolean
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 |
# File 'ext/primitive/primitive.c', line 1098
static VALUE
r_Int16_equals(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
if (TYPE(o) == T_DATA) {
if (RBASIC(o)->klass == r_Int16) {
Int16 *op;
Data_Get_Struct(o, Int16, op);
if (p->value == op->value)
return Qtrue;
}
}
return Qfalse;
}
|
#equals(o) ⇒ Object
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 |
# File 'ext/primitive/primitive.c', line 1098
static VALUE
r_Int16_equals(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
if (TYPE(o) == T_DATA) {
if (RBASIC(o)->klass == r_Int16) {
Int16 *op;
Data_Get_Struct(o, Int16, op);
if (p->value == op->value)
return Qtrue;
}
}
return Qfalse;
}
|
#hash ⇒ Object
1127 1128 1129 1130 1131 1132 1133 |
# File 'ext/primitive/primitive.c', line 1127
static VALUE
r_Int16_hash(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return LONG2NUM((long) __hash_int32(p->value));
}
|
#hashCode ⇒ Object
1113 1114 1115 1116 1117 1118 1119 |
# File 'ext/primitive/primitive.c', line 1113
static VALUE
r_Int16_hashCode(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __allocate_Int32(__hash_int32(p->value));
}
|
#inspect ⇒ Object
1134 1135 1136 1137 1138 1139 1140 |
# File 'ext/primitive/primitive.c', line 1134
static VALUE
r_Int16_to_s(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __int32_to_s(p->value);
}
|
#to_byte ⇒ Object
1141 1142 1143 1144 1145 1146 1147 |
# File 'ext/primitive/primitive.c', line 1141
static VALUE
r_Int16_to_byte(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __allocate_Byte((int8_t) p->value);
}
|
#to_char ⇒ Object
1148 1149 1150 1151 1152 1153 1154 |
# File 'ext/primitive/primitive.c', line 1148
static VALUE
r_Int16_to_char(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __allocate_Char((uint16_t) p->value);
}
|
#to_f ⇒ Object
1195 1196 1197 1198 1199 1200 1201 |
# File 'ext/primitive/primitive.c', line 1195
static VALUE
r_Int16_to_f(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __int32_to_f(p->value);
}
|
#to_float32 ⇒ Object
1174 1175 1176 1177 1178 1179 1180 |
# File 'ext/primitive/primitive.c', line 1174
static VALUE
r_Int16_to_float32(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __allocate_Float32((float) p->value);
}
|
#to_float64 ⇒ Object
1181 1182 1183 1184 1185 1186 1187 |
# File 'ext/primitive/primitive.c', line 1181
static VALUE
r_Int16_to_float64(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __allocate_Float64((double) p->value);
}
|
#to_i ⇒ Object
1188 1189 1190 1191 1192 1193 1194 |
# File 'ext/primitive/primitive.c', line 1188
static VALUE
r_Int16_to_i(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __int32_to_i(p->value);
}
|
#to_int ⇒ Object
1188 1189 1190 1191 1192 1193 1194 |
# File 'ext/primitive/primitive.c', line 1188
static VALUE
r_Int16_to_i(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __int32_to_i(p->value);
}
|
#to_int16 ⇒ Object
1155 1156 1157 1158 1159 |
# File 'ext/primitive/primitive.c', line 1155
static VALUE
r_Int16_to_int16(VALUE self)
{
return self;
}
|
#to_int32 ⇒ Object
1160 1161 1162 1163 1164 1165 1166 |
# File 'ext/primitive/primitive.c', line 1160
static VALUE
r_Int16_to_int32(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __allocate_Int32((int32_t) p->value);
}
|
#to_int64 ⇒ Object
1167 1168 1169 1170 1171 1172 1173 |
# File 'ext/primitive/primitive.c', line 1167
static VALUE
r_Int16_to_int64(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __allocate_Int64((int64_t) p->value);
}
|
#to_s ⇒ Object
1134 1135 1136 1137 1138 1139 1140 |
# File 'ext/primitive/primitive.c', line 1134
static VALUE
r_Int16_to_s(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __int32_to_s(p->value);
}
|
#toString ⇒ Object
1120 1121 1122 1123 1124 1125 1126 |
# File 'ext/primitive/primitive.c', line 1120
static VALUE
r_Int16_toString(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return rb_funcall(__int32_to_s(p->value), TO_J_ID, 0);
}
|
#ushr(o) ⇒ Object
1339 1340 1341 1342 1343 1344 1345 1346 1347 |
# File 'ext/primitive/primitive.c', line 1339
static VALUE
r_Int16_ushr(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
uint32_t u = (uint32_t) p->value;
int32_t d = __accept_int32(o);
return __allocate_Int32((int32_t) (u >> d));
}
|
#|(o) ⇒ Object
1364 1365 1366 1367 1368 1369 1370 1371 |
# File 'ext/primitive/primitive.c', line 1364
static VALUE
r_Int16_or(VALUE self, VALUE o)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
int32_t v = __accept_int32(o);
return __allocate_Int32(p->value | v);
}
|
#~ ⇒ Object
1316 1317 1318 1319 1320 1321 1322 |
# File 'ext/primitive/primitive.c', line 1316
static VALUE
r_Int16_inv(VALUE self)
{
Int16 *p;
Data_Get_Struct(self, Int16, p);
return __allocate_Int32(~p->value);
}
|