Back to Influxdb

bitwise.unot() function

content/flux/v0/stdlib/bitwise/unot.md

latest3.4 KB
Original Source
<!------------------------------------------------------------------------------ IMPORTANT: This page was generated from comments in the Flux source code. Any edits made directly to this page will be overwritten the next time the documentation is generated. To make updates to this documentation, update the function comments above the function definition in the Flux source code: https://github.com/influxdata/flux/blob/master/stdlib/bitwise/bitwise.flux#L93-L93 Contributing to Flux: https://github.com/influxdata/flux#contributing Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md ------------------------------------------------------------------------------->

bitwise.unot() inverts every bit in a, an unsigned integer.

Function type signature
js
(a: uint) => uint

{{% caption %}} For more information, see Function type signatures. {{% /caption %}}

Parameters

a

({{< req >}}) Unsigned integer to invert.

Examples

Invert bits in an unsigned integer

js
import "bitwise"

bitwise.unot(a: uint(v: 1234))// Returns 18446744073709550381 (uint)


Invert bits in unsigned integers in a stream of tables

js
import "bitwise"
import "sampledata"

sampledata.uint()
    |> map(fn: (r) => ({r with _value: bitwise.unot(a: r._value)}))

{{< expand-wrapper >}} {{% expand "View example input and output" %}}

Input data

_time_value*tag
2021-01-01T00:00:00Z18446744073709551614t1
2021-01-01T00:00:10Z10t1
2021-01-01T00:00:20Z7t1
2021-01-01T00:00:30Z17t1
2021-01-01T00:00:40Z15t1
2021-01-01T00:00:50Z4t1
_time_value*tag
2021-01-01T00:00:00Z19t2
2021-01-01T00:00:10Z4t2
2021-01-01T00:00:20Z18446744073709551613t2
2021-01-01T00:00:30Z19t2
2021-01-01T00:00:40Z13t2
2021-01-01T00:00:50Z1t2

Output data

_time_value*tag
2021-01-01T00:00:00Z1t1
2021-01-01T00:00:10Z18446744073709551605t1
2021-01-01T00:00:20Z18446744073709551608t1
2021-01-01T00:00:30Z18446744073709551598t1
2021-01-01T00:00:40Z18446744073709551600t1
2021-01-01T00:00:50Z18446744073709551611t1
_time_value*tag
2021-01-01T00:00:00Z18446744073709551596t2
2021-01-01T00:00:10Z18446744073709551611t2
2021-01-01T00:00:20Z2t2
2021-01-01T00:00:30Z18446744073709551596t2
2021-01-01T00:00:40Z18446744073709551602t2
2021-01-01T00:00:50Z18446744073709551614t2

{{% /expand %}} {{< /expand-wrapper >}}