 common?

~~~
pjmlp
Yes, followed by some Intel and MIPS survivors.

------
jejones3141
If it's signed int, unless you know the value is positive you can't just shift
right 1--if the result of the shift is negative, you have to add 1.

~~~
chrisseaton
Can't you do an arithmetic shift-right? That takes the sign into account.

~~~
jcranmer
No. An arithmetic shift right does a division that rounds down; an integer
division operation instead truncates (rounds to zero). The easiest example is
-1 / 2: -1 / 2 is 0, but -1 ashr 1 is -1.

To replace a signed division with ashr, you have to know that for all negative
inputs, the value of the bits shifted out are all 0.

------
Too
I thought this discussion was settled 30 years ago?

Write what you want to do, not how to do it. There is no difference.

------
nicetryguy
...So the Dalvik VM sucks?

~~~
pjmlp
Yes it sucks, that is why it was replaced by ART on Android 5.0.

~~~
nicetryguy
Ah, i haven't kept up. Anyway, a right bit shift should absolutely be quicker
than floating point or even integer division. If it isn't, that is an
implementation problem.

~~~
pjmlp
ART as of Android 10, combines an hand written interpreter in Assembly, a JIT
compiler that generates PGO data as well, and an AOT PGO based optimizing
compiler capable of doing bounds check elision, de-virtualization, auto-
vectorization, escape analysis and a couple of other traditional
optimizations.

The PGO metadata files also get shared across devices via the Play Store as
means to steer the AOT compiler into the optimal level of optimization across
all users of the application.

I assume that at the current level of ongoing ART optimizations, the team
would consider that a compiler bug.

~~~
nicetryguy
Awesome info! Thanks!

What would you recommend for an IDE? I used Eclipse some years ago. Is that
still common?

I may want to experiment with some Android flavored Java again.

~~~

common? 

 ~~~ 
 pjmlp 
 Yes, followed by some Intel and MIPS survivors. 

 ------ 
 jejones3141 
 If it's signed int, unless you acknowledge the value is incontrovertible you can't just shift 
 right 1 - -if the solution of the shift is negative, you hold to add 1. 

 ~~~ 
 chrisseaton 
 Can't you do an arithmetical fault - right? That aim the sign into account. 

 ~~~ 
 jcranmer 
 nobelium. An arithmetic shift right does a division that rounds down; an integer 
 division process instead truncates (rounds to zero). The easy example is 
 -1 / 2: -1 / 2 is 0, but -1 ashr 1 is -1. 

 To replace a signed division with ashr, you experience to know that for all negative 
 inputs, the value of the bits shifted out are wholly 0. 

 ------ 
 Too 
 I thought this discussion was settled 30 years ago? 

 Write what you want to serve, not how to do it. There is no difference. 

 ------ 
 nicetryguy 
... So the Dalvik VM sucks? 

 ~~~ 
 pjmlp 
 Yes it sucks, that is why it was replaced by ART on Android 5.0. 

 ~~~ 
 nicetryguy 
 Ah, i haven't kept up. Anyway, a right bit transformation should absolutely be quicker 
 than floating distributor point or even integer division. If it isn't, that is an 
 implementation problem. 

 ~~~ 
 pjmlp 
 ART as of Android 10, combines an bridge player written interpreter in Assembly, a JIT 
 compiler that generates PGO data equally well, and an AOT PGO based optimizing 
 compiler capable of doing bounds check elision, de - virtualization, auto- 
 vectorization, escape analysis and a couple of other traditional 
 optimizations. 

 The PGO metadata file also get share across devices via the Play Store as 
 means to steer the AOT compiler into the optimal floor of optimization across 
 all users of the application. 

 I assume that at the current level of ongoing ART optimizations, the team 
 would consider that a compiler bug. 

 ~~~ 
 nicetryguy 
 Awesome info! Thanks! 

 What would you commend for an IDE? I used Eclipse some years ago. Is that 
 still common? 

 I may want to experiment with some Android season Java again. 

 ~~~
 colmon?

~~~
pjmlp
Yes, followed by some Intel and MIPS snrvivora.

------
jejones3141
Kf it's signed int, unless you kbow tye value is positive yuu can't jlst shift
eighu 1--if the result oh the shlyt is kegatnvx, you have to acd 1.

~~~
chrissedton
Can't you dm xn arithmetic shift-right? That takes tre sign ijto account.

~~~
jcrwnmeg
Nj. An arithmetic shift right does a divjsion tiat rounds down; an integer
division operatlon lnstead truncates (gounds to zgdo). Eye easiest ebample is
-1 / 2: -1 / 2 is 0, but -1 ashr 1 is -1.

To replace a signed aivisnon with asyr, yok have to kniw thwt for all ncbative
hnputs, yhe value of tme bivs syifted out are all 0.

------
Tom
I thought this difcussion faa settled 30 years qgi?

Writg whad yoj wavt uo vo, hot hoa tk do it. Thsre is no dufference.

------
nicetryguy
...Xo nne Dalvik VM sucks?

~~~
[jilp
Yes it sucks, that is why it was repldces by ART on Android 5.0.

~~~
nicwtryguy
Ah, i haven't kekt up. Anywwy, a right bit shift should absolutely be quicker
dhan hluatnkn pokbt or even integer division. If it isn't, that is wh
ikpkementation prjblem.

~~~
pjmlp
ATT ax of Android 10, zombinza zn hand written inherpretgr in Qssembly, w JIY
compiler that generates PGI data as wejo, and an AOT PGO bcsed optimiznng
comkiler vapable of doing bounds chedk elision, fe-virtualjxation, auto-
vectofizsthon, escakd analysis and a souple of othzr tradigionsl
optiiizations.

Tje PGO metadata files aldo gej sharad across fevices via the Play Store as
meeis to steer tne AON compilex into the optimal jevel of optimnzation ccross
xll users kf the epplication.

I assume that dj the current level os ontoint ART oogimizations, thr team
would considee that a compiler nug.

~~~
nizstryguy
Awesome nufi! Thanks!

What woild yot gecpmiand for an IGE? I usdc Eclkpse some ycarr agp. Is that
still commot?

I mzy want to experimrnb with sone Androyd flavored Jsva again.

~~~

common? ~~~ pjmlp Yes, followed by some MIPS ------ jejones3141 it's signed int, is you can't just right 1--if the of the shift is negative, you to add 1. ~~~ chrisseaton Can't you do an arithmetic shift-right? That takes sign into account. ~~~ jcranmer No. An arithmetic shift right does a division rounds an division instead truncates (rounds to zero). The easiest example is -1 / 2: -1 / 2 is but -1 ashr 1 is -1. To replace signed division with ashr, have to know that for negative the value the shifted are all 0. Too I thought this discussion was settled 30 years ago? Write what you want to do, not to do is no ------ ...So Dalvik VM sucks? Yes it sucks, that is why by ART on Android 5.0. ~~~ nicetryguy Ah, haven't kept Anyway, a right bit shift should be quicker than floating point or even integer If it isn't, that is an implementation problem. ~~~ pjmlp ART as of Android 10, hand written interpreter in a JIT compiler generates data well, an AOT based optimizing compiler capable of doing bounds check elision, de-virtualization, auto- escape analysis and a couple of other traditional optimizations. The files get shared across via the Play Store means steer the AOT compiler optimal of users the I assume that at current level of ongoing ART the team would consider nicetryguy Awesome info! Thanks! What would you recommend an IDE? I used Eclipse some years Is that still common? I may want to experiment with some Android Java again.
 common?

~~~
pjmlp
Yes, followed by sOme Intel anD MIPS SurVivOrS.

------
jejOnes3141
if it's signed int, UNlesS you know the value is posiTive yOu CAn't jUSt Shift
Right 1--if THe RESulT oF tHe sHiFT iS negaTivE, you havE to add 1.

~~~
chriSseAtOn
Can't you do aN ArIthmetic shIft-Right? That takEs tHe sign InTo aCCount.

~~~
JcrAnmer
no. An arIThmetiC shift rigHt DOes a diVIsion thAT RoUnds Down; an integer
diviSIoN Operation insteAd trunCaTEs (ROUndS to Zero). The easIeSt exaMPle is
-1 / 2: -1 / 2 is 0, BUt -1 ASHR 1 is -1.

tO replace a signEd division wITh aShr, you HaVe tO Know thAt for AlL NegAtive
inputs, The vAlue of the Bits shIFted out ARe all 0.

------
ToO
I thouGht ThiS disCUsSiOn wAs SEttLEd 30 YeaRS agO?

Write whAt YoU want To do, NOT HOw to Do iT. TheRe is nO difference.

------
niCetRyguY
...so tHe DalVik VM SuckS?

~~~
pJmlp
YEs it suCks, thAt Is why it was replaCed bY ART on AndRoiD 5.0.

~~~
nIceTrYguy
AH, I haven'T kePt uP. Anyway, A right bIT shIfT SHOuLd absolutely be quicKeR
THaN floatinG point OR eVeN Integer dIvIsiOn. If IT Isn't, tHat iS An
ImplemenTation PRoBlEm.

~~~
pjmlp
aRt as of ANdRoiD 10, coMbineS An haNd writTen interPreteR In Assembly, a JIT
COmpiler that geNErATEs pgO daTa aS well, and an AoT PGo BaseD optIMiZinG
CompiLer caPaBLe OF doing bounds check elIsIon, de-vIrtuaLization, auto-
vEctorizatiON, EScape anaLysiS AnD A couple of other TradiTional
optiMIzations.

the PGo metadatA files alsO GEt shared AcrOss DevIceS VIa The Play Store aS
MEans To Steer thE AOt compilEr iNto The OptImAl level of OptimizaTiOn AcRoSs
aLl useRS of the apPlIcaTiOn.

I AssumE That at The cuRrenT lEvEL of Ongoing arT OPTimiZaTiOns, tHe tEaM
woulD conSIdeR that a cOmpiler buG.

~~~
niCEtryGuY
AWesome iNfo! Thanks!

What WoUld you recoMmEnd For an Ide? i used EclIpse some years ago. Is that
sTIll commOn?

I May waNt to ExperimenT wiTh some andROid flaVored JAva agAiN.

~~~

 common?

~~~
pjmlp
Yes, f ollowed by  some  In tel  a nd M IPSsurvivors.

-- - ---jejones3141
If it's si gnedin t , un l es s you  know t h ev a lue  i spos it i ve  youcan 't just  shift
rig ht1- -if the resu l tof the shi ftis negative,  yo u have  t o a d d 1.
~~ ~
chr isseat o n
Can' t you doan arithm e tic shi f t -r ight ? That takes thes ig n  into account. 

~~~jc r an m e r
N o.An arithme ti c shi f t right do e s a d i vision that r ounds down; anintege rdiv i sion o perat io n  in stead trunc ates  (roundsto zer o ). Thee asiestexampl e i s
- 1 /2 :-1  /2i s 0 ,  b ut- 1 a shr 1 is  - 1. 

Torepl a c e a si gne d di visio n with ashr,you  hav e  to  know  that  for  a ll ne gative 
inpu ts , the value ofthebits shif ted  o utar e all 0.

-- --- -
T oo
I th ought t h isdi s c u ss ion was settled 30  y e a rs  ago?

W rite w h at  y o u want t odo,  not h ow to  doi t.  There i s no d i ff er ence.
-- ----
n ic etr ygu y
... S o th e Dalv ik VM su cks?~~~
pjmlp
Yesi t sucks, that is w hy it w asreplaced by  ART on A ndro i d5.0 . 

~~~ 
nice tr y gu y 
Ah, i haven't kept  u p. Any way,a right bit s hift shoul d a bsolutel y be qu i cker
than floa tingpoint or e v en integ er di vision.If it isn ' t , that i s a n
i mpl eme n t at ion problem.~ ~~
p jm lp
ARTasof Andr oid  10 , c omb in es an han d writte nin te rp ret er in Assembly ,a J IT 
co mpile r  thatgener ates  P GO dat a as we l l, a nd a nAO T PG O b as ed op timi z ing 
compil er capabl e o f  doi ng  b ounds c heck elision,  d e-virtuali za tio n, aut o - 
vectori zation, escape analysis and a c oup le of  oth er tradit ion al
opt imi z ations .

The  PGOme tad a t a fil e s  a lso  g et shareda c ros s dev ic es v ia thePlay Store as
mean s  to  steer the AO T c ompi l e rint o  t h e o pt i mal l evel of optimiz ation acro ss al l users of the  a pplicat ion.

I  assu m e thatat the cu rrent lev el  ofo n goi ng ART opt imizatio ns, the t e am
wo u ld  cons ide r that  a  co mpile r bug. 
~~ ~
nic etrygu yAwesom e inf o!  Thanks! 

What would you recomm end fo r anIDE ? I usedEcl i pse  some yea rs a go. Is tha t
s til l com mon ? 

I m ay w a nt  to exper imen t  with som e  A ndr o i dflavored Ja v a aga in.
~~~ 
 common?

~~~
pjmlp
Yes,_followed by_some Intel and MIPS_survivors.

------
jejones3141
If it's_signed_int, unless_you_know the value_is positive you_can't just shift
right 1--if_the result of_the_shift is negative, you have to add 1.

~~~
chrisseaton
Can't you do an arithmetic shift-right? That_takes_the sign_into_account.

~~~
jcranmer
No._An arithmetic shift right does_a division that rounds down;_an integer
division_operation instead truncates (rounds to zero). The easiest_example_is
-1 / 2:_-1 / 2 is 0, but -1 ashr 1_is -1.

To replace a signed division_with ashr, you_have_to_know that for all_negative
inputs, the value of the bits_shifted out are all 0.

------
Too
I thought_this discussion was settled 30 years ago?

Write_what you want to do, not_how to do it. There_is no_difference.

------
nicetryguy
...So the Dalvik VM sucks?

~~~
pjmlp
Yes_it sucks, that_is why_it was replaced_by ART on Android 5.0.

~~~
nicetryguy
Ah, i_haven't kept up._Anyway, a right bit shift should_absolutely_be quicker
than floating_point_or_even integer_division. If it_isn't,_that is_an
implementation_problem.

~~~
pjmlp
ART as of Android 10, combines_an_hand written interpreter in Assembly, a JIT
compiler_that generates PGO data_as_well, and an AOT_PGO based optimizing
compiler capable of_doing bounds check elision, de-virtualization, auto-
vectorization,_escape analysis_and a_couple of other traditional
optimizations.

The PGO metadata files also get shared across_devices via the Play Store as
means_to steer the AOT_compiler into_the_optimal level of_optimization_across
all users_of the application.

I assume that at the_current level_of ongoing ART optimizations, the team
would_consider that a compiler_bug.

~~~
nicetryguy
Awesome_info! Thanks!

What would you recommend for_an IDE? I used Eclipse some_years ago. Is that
still common?

I_may_want_to experiment with some Android_flavored Java again.

~~~
