# BITS type in F202Y

**URL:** <https://fortran-lang.discourse.group/t/bits-type-in-f202y/6007>\
**Category:** Language enhancement\
**Created:** [June 20, 2023, 7:53am UTC](https://fortran-lang.discourse.group/t/bits-type-in-f202y/6007 "2023-06-20T07:53:14Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![jeremie.vandenplas](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jeremie.vandenplas](https://fortran-lang.discourse.group/u/jeremie.vandenplas)\
**Post date:** [June 26, 2023, 8:34am UTC](https://fortran-lang.discourse.group/t/bits-type-in-f202y/6007/10 "2023-06-26T08:34:26Z")

</div>

> [@PierU](#):
>
> However, my understanding is that as long as one doesn’t use the integer values per se, this should not be a problem,

This is my issue/incertainty.  
In one of my applications, I have a matrix `mat` of `integer(int8)` that contains compressed data. Values of `mat` might be negative or positive. Compressed elements correspond to two bits of the `int8` integers.

Decompression is done using `ibits`, e.g.:

```fortran
integer(int8), allocatable :: mat(:,:)
real, parameter :: decomp(0:3) = [....]
real :: tmp

...
tmp = decomp( ibits(mat(i,j), 6, 2) )
...

```

So, I think that this use must assume two’s complement arithmetic, especially as I use the last bit of possibly negative integers.

---

_[View the full topic](https://fortran-lang.discourse.group/t/bits-type-in-f202y/6007)._
