GLib.Bytes.compare

### Method

# GLib Bytescompare

since: 2.32

#### Declaration [src]

    gint
    g_bytes_compare (
      gconstpointer bytes1,
      gconstpointer bytes2
    )

#### Description [src]

Compares the two `GBytes` values.

This function can be used to sort `GBytes` instances in lexicographical order.

If `bytes1` and `bytes2` have different length but the shorter one is a prefix of the longer one then the shorter one is considered to be less than the longer one. Otherwise the first byte where both differ is used for comparison. If `bytes1` has a smaller value at that position it is considered less, otherwise greater than `bytes2`.

Available since: 2.32

#### Parameters

`bytes2`

  Type: `GBytes`

  A pointer to a `GBytes` to compare with `bytes1`.

#### Return value

Type: `gint`

A negative value if `bytes1` is less than `bytes2`, a positive value if `bytes1` is greater than `bytes2`, and zero if `bytes1` is equal to `bytes2`.