optimized multiplications using only shifts and additions

I have some doubts regarding the implementation of multiplications by shifts and adds only.

I have a set of coefficients that I’ve use to multiply some variable. For example, I need to multiply tmp by coefficient 15/36. The coefficient is always in the for of k/2^m, and I have a lot of different coefficients (99 in total, and k<2^m). Hence I have the next:

tmp*15/36 is equivalent to (tmp<<3 + tmp<<2 + tmp<<1 + tmp)>>5. It requires 11 shifts and 3 additions.

Now, with this coefficient it is more efficient to do the next: tmp – tmp*17/36 which is equivalent to tmp – (tmp<<4 + tmp)>>5. In this case the same result is obtained with 9 shifts and 1 addition and 1 subtraction, which is a bit more optimized than in the first case.

Contrary, when coefficient is 19/32 it is more efficient to keep it like that, than to use it as 1-13/32, since the number of shifts and adds will be the same and we will need one subtraction in addition.

In summary, my question is how to determinate when to use coefficient directly, and when to use it in the form of 1-(2^m-k)/2^m? Is there any way to conclude it automatically?

Thank you.

Folder for Guest Additions – does that mean it’s installed?

I am running ubuntu as host and windows 10 on my vm. I tried installing guest additions but I am not sure it was successful. I have a folder called guest additions on my windows 10 (guest vm) — do I need to run this setup file to mount it? From the Windows 10 guest vm, under CD DRIVE (D:) I see CCCOMA_X64FRE_EN-US_DV9. No idea what this is so maybe it’s the guest additions file?

[see guest additions folder][1]

Guest additions install failure Windows 7

When I installed Orace Virtual Box I installed guest additions as the secondary master drive.

The location of the guest additions is

C:/prog files/oracle v box/guestaddition.iso

I know I did not know why I installed this on the original Oracle Virtual Box install and now I am unable to successfully install Guest Additions through the command line on my Ubuntu installation.

I was able to successfully download the guest additions iso through ubuntu however I have an error log message when trying to install it.

Is there any specific error message I need to provide to get to the core of this problem?

I could post the entire error log of the unsuccessful guest additions install from terminal however it is quite lengthy.

I’m thinking that there is a conflict between the already installed Oracle guest additions and the successfully downloaded ubuntu but not installed guest additions.

Thank you.

Using O-notation for asymptotic estimation of the number of additions in recursive function

the number of additions that are executed during the calculation is a(n). How can i find an asymptotic estimation for the function mystery(n) with the help of the O-notation and master theorem. Note: here the question is not asked for the value of mystery(n), but rather for the number of additions!

def mystery(n):     if n==0:         return n * n     return 2 * mystery(n/3) + 4 * n 

What is the Virtuallbox guest additions kernel module called?

I installed Virtualbox 6.0 on my laptop which is UEFI with SecureBoot enabled, so I had the added complication of having to sign the kernel modules, which I identified as:

  • vboxdrv
  • vboxnetadp
  • vboxnetflt
  • vboxpci

However I overlooked the fact that the guest additions is also a kernel module and has to be signed, seems strange that I can’t seem to find something as simple as the module name, which I am guessing is vboxguest?

so I can sign it with:

sudo /usr/src/linux-headers-$  (uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $  (modinfo -n vboxguest)