This file is indexed.

/usr/share/octave/packages/interval-3.1.0/@infsupdec/bitunpack.m is in octave-interval 3.1.0-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
## Copyright 2014-2016 Oliver Heimlich
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @documentencoding UTF-8
## @defmethod {@@infsupdec} bitunpack (@var{X})
## @comment DO NOT SYNCHRONIZE DOCUMENTATION STRING
##
## Encode decorated interval @var{X} in interchange format.
##
## The result is a raw bit pattern of length 136 that derive from two binary64
## numbers plus 8 bit for the decoration.  Bits are in increasing order.
## Byte order depends on the system's endianness.  First 8 bytes come from the
## lower interval boundary, next 8 bytes come from the upper interval boundary,
## last byte comes from the decoration.
##
## The result is a row vector if @var{X} is a row vector; otherwise, it is a
## column vector.
##
## For all scalar intervals the following equation holds:
## @code{@var{X} == interval_bitpack (bitunpack (@var{X}))}.
##
## @seealso{interval_bitpack}
## @end defmethod

## Author: Oliver Heimlich
## Keywords: interval
## Created: 2014-12-23

function result = bitunpack (x)

  if (nargin ~= 1)
    print_usage ();
    return
  endif

  bare = bitunpack (x.infsup);
  d = bitunpack (x.dec);

  ## The exchange representation of [NaI] is (NaN, NaN, ill).
  if (any (isnai (x)(:)))
    bare(vec (1:128) + 128 .* vec (find (isnai (x)) - 1, 2)) = ...
    [bitunpack(nan (sum (isnai (x)), 2))];
  endif

  ## Initialize result vector
  result = zeros (1, length (bare) + length (d), 'logical');
  if (not (isrow (bare)))
    result = result';
  endif

  ## Merge alternating 128 bit blocks from bare and 8 bit blocks from d together
  ## into result.
  target_bare = reshape (1 : length (result), 8, length (result) / 8);
  target_d = target_bare (:, 17 : 17 : size (target_bare, 2));
  target_bare(:, 17 : 17 : size (target_bare, 2)) = [];
  result(target_bare) = bare;
  result(target_d) = d;

endfunction

%!test
%!  littleendian = bitunpack (uint16 (1))(1);
%!  b = zeros (1, 136);
%!  if (littleendian)
%!    b([52, 63, 117, 127, 133]) = 1;
%!  else
%!    b([7, 12, 71, 77, 133]) = 1;
%!  endif
%!  assert (bitunpack (infsupdec (3, 4)), logical (b));