Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Bit wise calculations #14

Open
AmitKumarDas opened this issue Dec 24, 2015 · 0 comments
Open

Bit wise calculations #14

AmitKumarDas opened this issue Dec 24, 2015 · 0 comments

Comments

@AmitKumarDas
Copy link

  • multiplication by shifts & adds
  - n * 3 = (n*2) + (n*1) = (n << 1) + (n)
  • multiplications
  12 * 2 = 12 << 1
  12 * 4 = 12 << 2
  12 * 8 = 12 << 3
  12 * 16 = 12 << 4
  12 * 32 = 12 << 5
  12 * 64 = 12 << 6
  12 * 128 = 12 << 7
  12 * 256 = 12 << 8
  • divisions
  12 / 2 = 12 >> 1
  12 / 4 = 12 >> 2
  12 / 8 = 12 >> 3
  12 / 16 = 12 >> 4
  12 / 32 = 12 >> 5
  12 / 64 = 12 >> 6
  12 / 128 = 12 >> 7
  12 / 256 = 12 >> 8
  • tips
  chunk length = 1024 * 1024 = 2^10 * 2^10 = 2^20
  chunk shift = 20

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant