3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encode($int) { $int = round($int); $left = 0xffffffff00000000; $right = 0x00000000ffffffff; $l = ($int & $left) >>32; $r = $int & $right; return unpack('d', pack('NN', $l, $r))[1]; } function decode($float){ $set = unpack('N2', pack('d', $float)); return $set[1] << 32 | $set[2]; } $float = encode(10000000000000);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dvWAH
function name:  (null)
number of ops:  5
compiled vars:  !0 = $float
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'encode'
          1        SEND_VAL                                                 10000000000000
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
          4      > RETURN                                                   1

Function encode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dvWAH
function name:  encode
number of ops:  24
compiled vars:  !0 = $int, !1 = $left, !2 = $right, !3 = $l, !4 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'round'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !0, $5
    5     5        ASSIGN                                                   !1, 1.84467e+19
    6     6        ASSIGN                                                   !2, 4294967295
    8     7        BW_AND                                           ~9      !0, !1
          8        SR                                               ~10     ~9, 32
          9        ASSIGN                                                   !3, ~10
    9    10        BW_AND                                           ~12     !0, !2
         11        ASSIGN                                                   !4, ~12
   11    12        INIT_FCALL                                               'unpack'
         13        SEND_VAL                                                 'd'
         14        INIT_FCALL                                               'pack'
         15        SEND_VAL                                                 'NN'
         16        SEND_VAR                                                 !3
         17        SEND_VAR                                                 !4
         18        DO_ICALL                                         $14     
         19        SEND_VAR                                                 $14
         20        DO_ICALL                                         $15     
         21        FETCH_DIM_R                                      ~16     $15, 1
         22      > RETURN                                                   ~16
   12    23*     > RETURN                                                   null

End of function encode

Function decode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dvWAH
function name:  decode
number of ops:  16
compiled vars:  !0 = $float, !1 = $set
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'unpack'
          2        SEND_VAL                                                 'N2'
          3        INIT_FCALL                                               'pack'
          4        SEND_VAL                                                 'd'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                         $3      
          9        ASSIGN                                                   !1, $3
   15    10        FETCH_DIM_R                                      ~5      !1, 1
         11        SL                                               ~6      ~5, 32
         12        FETCH_DIM_R                                      ~7      !1, 2
         13        BW_OR                                            ~8      ~6, ~7
         14      > RETURN                                                   ~8
   16    15*     > RETURN                                                   null

End of function decode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.61 ms | 1403 KiB | 20 Q