Class: Int32
- Inherits:
-
JAVA::Value
- Object
- JAVA::Value
- Int32
- 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
- #as_i ⇒ Object
- #as_ruby ⇒ Object
- #chr ⇒ Object
- #count ⇒ Object
- #downto(o) ⇒ Object
- #eql?(o) ⇒ Boolean
- #equals(o) ⇒ Object
- #hash ⇒ Object
- #hashCode ⇒ Object
- #inspect ⇒ Object
- #new_fixnum ⇒ Object
- #rol(o) ⇒ Object
- #ror(o) ⇒ Object
- #signum ⇒ Object
- #succ ⇒ Object
- #times ⇒ Object
- #to_byte ⇒ Object
- #to_char ⇒ Object
- #to_f ⇒ Object
- #to_fixnum ⇒ Object
- #to_float32 ⇒ Object
- #to_float64 ⇒ Object
- #to_hex ⇒ Object
- #to_i ⇒ Object
- #to_int ⇒ Object
- #to_int16 ⇒ Object
- #to_int32 ⇒ Object
- #to_int64 ⇒ Object
- #to_s ⇒ Object
- #toString ⇒ Object
- #upto(o) ⇒ Object
- #ushr(o) ⇒ Object
- #|(o) ⇒ Object
- #~ ⇒ Object
Methods inherited from JAVA::Value
Class Method Details
.[](o) ⇒ Object
1379 1380 1381 1382 1383 1384 |
# File 'ext/primitive/primitive.c', line 1379 static VALUE r_Int32_new(VALUE self, VALUE o) { int32_t value = __accept_int32(o); return __allocate_Int32(value); } |
Instance Method Details
#!=(o) ⇒ Object
1497 1498 1499 1500 1501 1502 1503 1504 |
# File 'ext/primitive/primitive.c', line 1497 static VALUE r_Int32_ne(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return p->value != v ? Qtrue : Qfalse; } |
#%(o) ⇒ Object
1533 1534 1535 1536 1537 1538 1539 1540 |
# File 'ext/primitive/primitive.c', line 1533 static VALUE r_Int32_mod(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return __allocate_Int32(__mod_int32(p->value, v)); } |
#&(o) ⇒ Object
1633 1634 1635 1636 1637 1638 1639 1640 |
# File 'ext/primitive/primitive.c', line 1633 static VALUE r_Int32_and(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return __allocate_Int32(p->value & v); } |
#*(o) ⇒ Object
1517 1518 1519 1520 1521 1522 1523 1524 |
# File 'ext/primitive/primitive.c', line 1517 static VALUE r_Int32_mul(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return __allocate_Int32(p->value * v); } |
#+(o) ⇒ Object
1541 1542 1543 1544 1545 1546 1547 1548 |
# File 'ext/primitive/primitive.c', line 1541 static VALUE r_Int32_add(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return __allocate_Int32(p->value + v); } |
#+@ ⇒ Object
1505 1506 1507 1508 1509 |
# File 'ext/primitive/primitive.c', line 1505 static VALUE r_Int32_pos(VALUE self) { return self; } |
#-(o) ⇒ Object
1549 1550 1551 1552 1553 1554 1555 1556 |
# File 'ext/primitive/primitive.c', line 1549 static VALUE r_Int32_sub(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return __allocate_Int32(p->value - v); } |
#-@ ⇒ Object
1510 1511 1512 1513 1514 1515 1516 |
# File 'ext/primitive/primitive.c', line 1510 static VALUE r_Int32_neg(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __allocate_Int32(-p->value); } |
#/(o) ⇒ Object
1525 1526 1527 1528 1529 1530 1531 1532 |
# File 'ext/primitive/primitive.c', line 1525 static VALUE r_Int32_div(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return __allocate_Int32(__div_int32(p->value, v)); } |
#<(o) ⇒ Object
1569 1570 1571 1572 1573 1574 1575 1576 |
# File 'ext/primitive/primitive.c', line 1569 static VALUE r_Int32_lt(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return p->value < v ? Qtrue : Qfalse; } |
#<<(o) ⇒ Object
1608 1609 1610 1611 1612 1613 1614 1615 |
# File 'ext/primitive/primitive.c', line 1608 static VALUE r_Int32_shl(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t d = __accept_int32(o); return __allocate_Int32(p->value << d); } |
#<=(o) ⇒ Object
1577 1578 1579 1580 1581 1582 1583 1584 |
# File 'ext/primitive/primitive.c', line 1577 static VALUE r_Int32_le(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return p->value <= v ? Qtrue : Qfalse; } |
#<=>(o) ⇒ Object
1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 |
# File 'ext/primitive/primitive.c', line 1557 static VALUE r_Int32_cmp(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, 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
1489 1490 1491 1492 1493 1494 1495 1496 |
# File 'ext/primitive/primitive.c', line 1489 static VALUE r_Int32_eq(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return p->value == v ? Qtrue : Qfalse; } |
#===(o) ⇒ Object
1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 |
# File 'ext/primitive/primitive.c', line 1385 static VALUE r_Int32_equals(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); if (TYPE(o) == T_DATA) { if (RBASIC(o)->klass == r_Int32) { Int32 *op; Data_Get_Struct(o, Int32, op); if (p->value == op->value) return Qtrue; } } return Qfalse; } |
#>(o) ⇒ Object
1593 1594 1595 1596 1597 1598 1599 1600 |
# File 'ext/primitive/primitive.c', line 1593 static VALUE r_Int32_gt(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return p->value > v ? Qtrue : Qfalse; } |
#>=(o) ⇒ Object
1585 1586 1587 1588 1589 1590 1591 1592 |
# File 'ext/primitive/primitive.c', line 1585 static VALUE r_Int32_ge(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return p->value >= v ? Qtrue : Qfalse; } |
#>>(o) ⇒ Object
1616 1617 1618 1619 1620 1621 1622 1623 |
# File 'ext/primitive/primitive.c', line 1616 static VALUE r_Int32_shr(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t d = __accept_int32(o); return __allocate_Int32(p->value >> d); } |
#^(o) ⇒ Object
1641 1642 1643 1644 1645 1646 1647 1648 |
# File 'ext/primitive/primitive.c', line 1641 static VALUE r_Int32_xor(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return __allocate_Int32(p->value ^ v); } |
#as_i ⇒ Object
1475 1476 1477 1478 1479 1480 1481 |
# File 'ext/primitive/primitive.c', line 1475 static VALUE r_Int32_to_i(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __int32_to_i(p->value); } |
#as_ruby ⇒ Object
1475 1476 1477 1478 1479 1480 1481 |
# File 'ext/primitive/primitive.c', line 1475 static VALUE r_Int32_to_i(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __int32_to_i(p->value); } |
#chr ⇒ Object
1690 1691 1692 1693 1694 1695 1696 |
# File 'ext/primitive/primitive.c', line 1690 static VALUE r_Int32_chr(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __int32_chr(p->value); } |
#count ⇒ Object
1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 |
# File 'ext/primitive/primitive.c', line 1724 static VALUE r_Int32_count(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t c = 0; uint32_t u = (uint32_t) p->value; while (u != 0) { u &= u - 1; c += 1; } return __allocate_Int32(c); } |
#downto(o) ⇒ Object
1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 |
# File 'ext/primitive/primitive.c', line 1777 static VALUE r_Int32_downto(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t i = p->value; int32_t v = __accept_int32(o); if (i >= v) { while (1) { rb_yield(__allocate_Int32(i)); if (i == v) break; i -= 1; } } return Qnil; } |
#eql?(o) ⇒ Boolean
1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 |
# File 'ext/primitive/primitive.c', line 1385 static VALUE r_Int32_equals(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); if (TYPE(o) == T_DATA) { if (RBASIC(o)->klass == r_Int32) { Int32 *op; Data_Get_Struct(o, Int32, op); if (p->value == op->value) return Qtrue; } } return Qfalse; } |
#equals(o) ⇒ Object
1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 |
# File 'ext/primitive/primitive.c', line 1385 static VALUE r_Int32_equals(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); if (TYPE(o) == T_DATA) { if (RBASIC(o)->klass == r_Int32) { Int32 *op; Data_Get_Struct(o, Int32, op); if (p->value == op->value) return Qtrue; } } return Qfalse; } |
#hash ⇒ Object
1414 1415 1416 1417 1418 1419 1420 |
# File 'ext/primitive/primitive.c', line 1414 static VALUE r_Int32_hash(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return LONG2NUM((long) __hash_int32(p->value)); } |
#hashCode ⇒ Object
1400 1401 1402 1403 1404 1405 1406 |
# File 'ext/primitive/primitive.c', line 1400 static VALUE r_Int32_hashCode(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __allocate_Int32(__hash_int32(p->value)); } |
#inspect ⇒ Object
1421 1422 1423 1424 1425 1426 1427 |
# File 'ext/primitive/primitive.c', line 1421 static VALUE r_Int32_to_s(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __int32_to_s(p->value); } |
#new_fixnum ⇒ Object
1676 1677 1678 1679 1680 1681 1682 |
# File 'ext/primitive/primitive.c', line 1676 static VALUE r_Int32_to_fixnum(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return LONG2NUM((long) p->value); } |
#rol(o) ⇒ Object
1706 1707 1708 1709 1710 1711 1712 1713 1714 |
# File 'ext/primitive/primitive.c', line 1706 static VALUE r_Int32_rol(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); uint32_t u = (uint32_t) p->value; int32_t d = __accept_int32(o); return __allocate_Int32((int32_t) (u << d | u >> (32 - d))); } |
#ror(o) ⇒ Object
1715 1716 1717 1718 1719 1720 1721 1722 1723 |
# File 'ext/primitive/primitive.c', line 1715 static VALUE r_Int32_ror(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); uint32_t u = (uint32_t) p->value; int32_t d = __accept_int32(o); return __allocate_Int32((int32_t) (u >> d | u << (32 - d))); } |
#signum ⇒ Object
1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 |
# File 'ext/primitive/primitive.c', line 1737 static VALUE r_Int32_signum(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); if (p->value < 0) return r_INT32_M1; if (p->value > 0) return r_INT32_1; return r_INT32_0; } |
#succ ⇒ Object
1697 1698 1699 1700 1701 1702 1703 1704 1705 |
# File 'ext/primitive/primitive.c', line 1697 static VALUE r_Int32_succ(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); if (p->value == 0x7FFFFFFF) rb_raise(rb_eStopIteration, "StopIteration"); return __allocate_Int32(p->value + 1); } |
#times ⇒ Object
1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 |
# File 'ext/primitive/primitive.c', line 1748 static VALUE r_Int32_times(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t i = 0; while (i < p->value) { rb_yield(__allocate_Int32(i)); i += 1; } return Qnil; } |
#to_byte ⇒ Object
1428 1429 1430 1431 1432 1433 1434 |
# File 'ext/primitive/primitive.c', line 1428 static VALUE r_Int32_to_byte(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __allocate_Byte((int8_t) p->value); } |
#to_char ⇒ Object
1435 1436 1437 1438 1439 1440 1441 |
# File 'ext/primitive/primitive.c', line 1435 static VALUE r_Int32_to_char(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __allocate_Char((uint16_t) p->value); } |
#to_f ⇒ Object
1482 1483 1484 1485 1486 1487 1488 |
# File 'ext/primitive/primitive.c', line 1482 static VALUE r_Int32_to_f(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __int32_to_f(p->value); } |
#to_fixnum ⇒ Object
1676 1677 1678 1679 1680 1681 1682 |
# File 'ext/primitive/primitive.c', line 1676 static VALUE r_Int32_to_fixnum(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return LONG2NUM((long) p->value); } |
#to_float32 ⇒ Object
1461 1462 1463 1464 1465 1466 1467 |
# File 'ext/primitive/primitive.c', line 1461 static VALUE r_Int32_to_float32(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __allocate_Float32((float) p->value); } |
#to_float64 ⇒ Object
1468 1469 1470 1471 1472 1473 1474 |
# File 'ext/primitive/primitive.c', line 1468 static VALUE r_Int32_to_float64(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __allocate_Float64((double) p->value); } |
#to_hex ⇒ Object
1683 1684 1685 1686 1687 1688 1689 |
# File 'ext/primitive/primitive.c', line 1683 static VALUE r_Int32_to_hex(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __int32_to_hex(p->value); } |
#to_i ⇒ Object
1475 1476 1477 1478 1479 1480 1481 |
# File 'ext/primitive/primitive.c', line 1475 static VALUE r_Int32_to_i(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __int32_to_i(p->value); } |
#to_int ⇒ Object
1475 1476 1477 1478 1479 1480 1481 |
# File 'ext/primitive/primitive.c', line 1475 static VALUE r_Int32_to_i(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __int32_to_i(p->value); } |
#to_int16 ⇒ Object
1442 1443 1444 1445 1446 1447 1448 |
# File 'ext/primitive/primitive.c', line 1442 static VALUE r_Int32_to_int16(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __allocate_Int16((int16_t) p->value); } |
#to_int32 ⇒ Object
1449 1450 1451 1452 1453 |
# File 'ext/primitive/primitive.c', line 1449 static VALUE r_Int32_to_int32(VALUE self) { return self; } |
#to_int64 ⇒ Object
1454 1455 1456 1457 1458 1459 1460 |
# File 'ext/primitive/primitive.c', line 1454 static VALUE r_Int32_to_int64(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __allocate_Int64((int64_t) p->value); } |
#to_s ⇒ Object
1421 1422 1423 1424 1425 1426 1427 |
# File 'ext/primitive/primitive.c', line 1421 static VALUE r_Int32_to_s(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __int32_to_s(p->value); } |
#toString ⇒ Object
1407 1408 1409 1410 1411 1412 1413 |
# File 'ext/primitive/primitive.c', line 1407 static VALUE r_Int32_toString(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return rb_funcall(__int32_to_s(p->value), TO_J_ID, 0); } |
#upto(o) ⇒ Object
1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 |
# File 'ext/primitive/primitive.c', line 1760 static VALUE r_Int32_upto(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t i = p->value; int32_t v = __accept_int32(o); if (i <= v) { while (1) { rb_yield(__allocate_Int32(i)); if (i == v) break; i += 1; } } return Qnil; } |
#ushr(o) ⇒ Object
1624 1625 1626 1627 1628 1629 1630 1631 1632 |
# File 'ext/primitive/primitive.c', line 1624 static VALUE r_Int32_ushr(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); uint32_t u = (uint32_t) p->value; int32_t d = __accept_int32(o); return __allocate_Int32((int32_t) (u >> d)); } |
#|(o) ⇒ Object
1649 1650 1651 1652 1653 1654 1655 1656 |
# File 'ext/primitive/primitive.c', line 1649 static VALUE r_Int32_or(VALUE self, VALUE o) { Int32 *p; Data_Get_Struct(self, Int32, p); int32_t v = __accept_int32(o); return __allocate_Int32(p->value | v); } |
#~ ⇒ Object
1601 1602 1603 1604 1605 1606 1607 |
# File 'ext/primitive/primitive.c', line 1601 static VALUE r_Int32_inv(VALUE self) { Int32 *p; Data_Get_Struct(self, Int32, p); return __allocate_Int32(~p->value); } |