(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    ["[0]" text (.only \n)
     ["%" \\format (.only format)]]]]]
 [\\library
  ["[0]" /]])

(`` (def .public documentation
      (List $.Documentation)
      (list ($.module /._
                      "")

            ($.definition /.bits_per_byte)
            ($.definition /.bytes_per_i64)
            ($.definition /.width)
            ($.definition /.false)
            ($.definition /.true)
            ($.definition /.equivalence)
            ($.definition /.hash)
            ($.definition /.disjunction)
            ($.definition /.conjunction)
            ($.definition /.reversed)
            ($.definition /.left_rotated)
            ($.definition /.right_rotated)

            (,, (with_template [<name> <doc>]
                  [($.definition <name>
                     <doc>)]

                  [/.or "Bitwise or."]
                  [/.xor "Bitwise xor."]
                  [/.and "Bitwise and."]
                  
                  [/.left_shifted "Bitwise left-shift."]
                  [/.right_shifted "Unsigned/logic bitwise right-shift."]
                  ))

            ($.definition /.Mask
              "A pattern of bits that can be imposed on I64 values.")

            ($.definition /.bit
              "A mask with only a specific bit set."
              [(bit position)])

            ($.definition /.sign
              "A mask for the sign bit of ints.")

            ($.definition /.not
              "Bitwise negation.")

            ($.definition /.mask
              "Mask a block of bits of the specified size."
              [(mask amount_of_bits)])

            ($.definition /.ones
              "Count the number of 1s in a bit-map."
              [(ones it)])

            (,, (with_template [<name> <doc>]
                  [($.definition <name>
                     <doc>)]

                  [/.zero "Clear bit at the given index."]
                  [/.one "Set bit at given index."]
                  [/.flipped "Flip bit at given index."]
                  ))

            ($.definition /.one?
              ""
              [(one? index input)])

            ($.definition /.zero?
              ""
              [(zero? index input)])

            ($.definition /.region
              "A mask for a block of bits of the given size, starting at the given offset."
              [(region offset size)])

            ($.definition (/.Sub width)
              "A sub-space of I64 with a reduce amount of bits.")

            ($.definition /.sub
              "Given a width in the interval (0,64), yields an implementation for integers of that width."
              [(sub width)])
            )))
