メインコンテンツまでスキップ
バージョン:25.2

bit, bits

  • keyword

    • 8-bit | 16-bit | 32-bit | 64-bit integer | 32-bit | 64-bit float
  • unit of dataSize

    • new in 1.67

    • There are 8 bits in 1 byte

    • Example:

      put 3 bytes as bits --> 24 bits
  • expression, function

    • new in 2.06

    • The bit expressions and function provide the ability to access or set an individual bit within a number. Bit 1 is the rightmost bit in the number in binary format, bit 2 is the next bit to the left, and so forth. Bits can be accessed up to bit 64, or whatever the bitLength is set to. Each bit is 0 or 1, and is also treated as a boolean value (True or False) for convenience in testing bits. You may set a bit either to a boolean (True, False, Yes, No, On, Off) or to 0 or 1.

    • Examples:

      set the numberFormat to "binary 8"
      set controlByte to 0b00001110
      put bit 1 of controlByte --> 0
      put bit 2 of controlByte --> 1
      set bit 7 of controlByte to On
      set bit 3 of controlByte to 0
      put controlByte --> 0b01001010
    • Related: bitLength