# [Pari/GP], 34 bytes

    (a,b)->sum(i=a,b,hammingweight(i))

[Try it online!][TIO-ji1uj1mn]

[Pari/GP]: http://pari.math.u-bordeaux.fr/
[TIO-ji1uj1mn]: https://tio.run/##K0gsytRNL/ifpmCr8F8jUSdJU9euuDRXI9MWyNbJSMzNzcxLL0/NTM8o0cjU1PxfUJSZV6KRpmGiYw7kAQA "Pari/GP – Try It Online"