home.social

Search

1000 results for “bitman”

  1. Re-reading old code and I’m reminded of this old trick for doing bit-manipulation:

    I was trying to shift right an u8 by a value between 1 and 8 bits:

    myu8 >> (8 - shift)

    If shift equals 0, this would be an 8 bits shift, I wanted the result to be zero (all bits shifted), but that's not how (some) CPUs work; so it's undefined behaviour, and in Rust, the compiler will throw a compile error (if it's a const shift), or panic at runtime in debug mode.

    One could test if shift is 8, and adjust code accordingly, but this adds branches and even more code.

    So the trick to work around that is simply... to shift twice ! One time for the first bit, and another for the last (potential 7):

    (myu8 >> 1) >> (8 - shift - 1)

    And that's how one can do this operation fully branchless.

    (another version of this post appeared on a now-defunct instance)

    #RustLang #bitmap #BitManip

  2. The real takeaway here is that +1 and -1 have simple and predictable effects on bit-masks and are really valuable for complex bit manipulation. If you're doing crazy stuff with bits, they're handy tools to keep close.

    #bitmanip

  3. Будни ретрогеймера: а я сказал — BITMAN

    Ретрогейминг — довольно популярное сейчас увлечение старыми компьютерными и видеоиграми, от истоков индустрии и до того момента, в который актуальное нынешнее превращается в пыльное ретро. На данный момент эта условная граница пролегает где-то между поколениями PlayStation 2 и 3, в начале 2000-х годов. Это явление включает в себя любопытные девиации в виде коллекционирования всех сортов, цифровой археологии, киберспорта и компьютерного творчества, но в основе его всё же находится вполне банальная игра в игры прошлых лет. Некоторым даже искренне нравится это занятие — ведь раньше было лучше, и в этом утверждении вполне можно отыскать крупицу истины. В современном мире вовсе не обязательно использовать реальные игровые устройства, картриджи и диски, но именно они являются краеугольным камнем ретрогейминга, источником всех этих старых игр. И если возжелать обратиться к этому подлиннику, обнаружится проблема: в 21-ом веке эти артефакты требуют обслуживания, мелкого ремонта и восстановления, а зачастую ещё и адаптации под современные реалии. Хотя в своих публикациях я обычно касаюсь более хардкорных граней ретрокомпьютинга, я тоже частенько ковыряюсь в старых приставках. Особенно кучно они пошли в этом году, и это навело на мысль посвятить этому занятию статью. Простая возня со старым железом, без мучительных копаний в википедийных фактах и прочей истории, околотехническое творчество и решение разнообразных проблем подручными средствами. Приступаем!

    habr.com/ru/companies/ruvds/ar

    #ruvds_статьи #ретрогейминг #консоль #игровая_приставка #sega #sega_megadrive #sega_mega_drive #sega_genesis #bitman #16bit #16bit_games #моддинг #pal #ntsc

  4. Будни ретрогеймера: а я сказал — BITMAN

    Ретрогейминг — довольно популярное сейчас увлечение старыми компьютерными и видеоиграми, от истоков индустрии и до того момента, в который актуальное нынешнее превращается в пыльное ретро. На данный момент эта условная граница пролегает где-то между поколениями PlayStation 2 и 3, в начале 2000-х годов. Это явление включает в себя любопытные девиации в виде коллекционирования всех сортов, цифровой археологии, киберспорта и компьютерного творчества, но в основе его всё же находится вполне банальная игра в игры прошлых лет. Некоторым даже искренне нравится это занятие — ведь раньше было лучше, и в этом утверждении вполне можно отыскать крупицу истины. В современном мире вовсе не обязательно использовать реальные игровые устройства, картриджи и диски, но именно они являются краеугольным камнем ретрогейминга, источником всех этих старых игр. И если возжелать обратиться к этому подлиннику, обнаружится проблема: в 21-ом веке эти артефакты требуют обслуживания, мелкого ремонта и восстановления, а зачастую ещё и адаптации под современные реалии. Хотя в своих публикациях я обычно касаюсь более хардкорных граней ретрокомпьютинга, я тоже частенько ковыряюсь в старых приставках. Особенно кучно они пошли в этом году, и это навело на мысль посвятить этому занятию статью. Простая возня со старым железом, без мучительных копаний в википедийных фактах и прочей истории, околотехническое творчество и решение разнообразных проблем подручными средствами. Приступаем!

    habr.com/ru/companies/ruvds/ar

    #ruvds_статьи #ретрогейминг #консоль #игровая_приставка #sega #sega_megadrive #sega_mega_drive #sega_genesis #bitman #16bit #16bit_games #моддинг #pal #ntsc

  5. Будни ретрогеймера: а я сказал — BITMAN

    Ретрогейминг — довольно популярное сейчас увлечение старыми компьютерными и видеоиграми, от истоков индустрии и до того момента, в который актуальное нынешнее превращается в пыльное ретро. На данный момент эта условная граница пролегает где-то между поколениями PlayStation 2 и 3, в начале 2000-х годов. Это явление включает в себя любопытные девиации в виде коллекционирования всех сортов, цифровой археологии, киберспорта и компьютерного творчества, но в основе его всё же находится вполне банальная игра в игры прошлых лет. Некоторым даже искренне нравится это занятие — ведь раньше было лучше, и в этом утверждении вполне можно отыскать крупицу истины. В современном мире вовсе не обязательно использовать реальные игровые устройства, картриджи и диски, но именно они являются краеугольным камнем ретрогейминга, источником всех этих старых игр. И если возжелать обратиться к этому подлиннику, обнаружится проблема: в 21-ом веке эти артефакты требуют обслуживания, мелкого ремонта и восстановления, а зачастую ещё и адаптации под современные реалии. Хотя в своих публикациях я обычно касаюсь более хардкорных граней ретрокомпьютинга, я тоже частенько ковыряюсь в старых приставках. Особенно кучно они пошли в этом году, и это навело на мысль посвятить этому занятию статью. Простая возня со старым железом, без мучительных копаний в википедийных фактах и прочей истории, околотехническое творчество и решение разнообразных проблем подручными средствами. Приступаем!

    habr.com/ru/companies/ruvds/ar

    #ruvds_статьи #ретрогейминг #консоль #игровая_приставка #sega #sega_megadrive #sega_mega_drive #sega_genesis #bitman #16bit #16bit_games #моддинг #pal #ntsc

  6. Re-reading old code and I’m reminded of this old trick for doing bit-manipulation:

    I was trying to shift right an u8 by a value between 1 and 8 bits:

    myu8 >> (8 - shift)

    If shift equals 0, this would be an 8 bits shift, I wanted the result to be zero (all bits shifted), but that's not how (some) CPUs work; so it's undefined behaviour, and in Rust, the compiler will throw a compile error (if it's a const shift), or panic at runtime in debug mode.

    One could test if shift is 8, and adjust code accordingly, but this adds branches and even more code.

    So the trick to work around that is simply... to shift twice ! One time for the first bit, and another for the last (potential 7):

    (myu8 >> 1) >> (8 - shift - 1)

    And that's how one can do this operation fully branchless.

    (another version of this post appeared on a now-defunct instance)

    #RustLang #bitmap #BitManip

  7. Re-reading old code and I’m reminded of this old trick for doing bit-manipulation:

    I was trying to shift right an u8 by a value between 1 and 8 bits:

    myu8 >> (8 - shift)

    If shift equals 0, this would be an 8 bits shift, I wanted the result to be zero (all bits shifted), but that's not how (some) CPUs work; so it's undefined behaviour, and in Rust, the compiler will throw a compile error (if it's a const shift), or panic at runtime in debug mode.

    One could test if shift is 8, and adjust code accordingly, but this adds branches and even more code.

    So the trick to work around that is simply... to shift twice ! One time for the first bit, and another for the last (potential 7):

    (myu8 >> 1) >> (8 - shift - 1)

    And that's how one can do this operation fully branchless.

    (another version of this post appeared on a now-defunct instance)

    #RustLang #bitmap #BitManip

  8. Re-reading old code and I’m reminded of this old trick for doing bit-manipulation:

    I was trying to shift right an u8 by a value between 1 and 8 bits:

    myu8 >> (8 - shift)

    If shift equals 0, this would be an 8 bits shift, I wanted the result to be zero (all bits shifted), but that's not how (some) CPUs work; so it's undefined behaviour, and in Rust, the compiler will throw a compile error (if it's a const shift), or panic at runtime in debug mode.

    One could test if shift is 8, and adjust code accordingly, but this adds branches and even more code.

    So the trick to work around that is simply... to shift twice ! One time for the first bit, and another for the last (potential 7):

    (myu8 >> 1) >> (8 - shift - 1)

    And that's how one can do this operation fully branchless.

    (another version of this post appeared on a now-defunct instance)

    #RustLang #bitmap #BitManip

  9. Re-reading old code and I’m reminded of this old trick for doing bit-manipulation:

    I was trying to shift right an u8 by a value between 1 and 8 bits:

    myu8 >> (8 - shift)

    If shift equals 0, this would be an 8 bits shift, I wanted the result to be zero (all bits shifted), but that's not how (some) CPUs work; so it's undefined behaviour, and in Rust, the compiler will throw a compile error (if it's a const shift), or panic at runtime in debug mode.

    One could test if shift is 8, and adjust code accordingly, but this adds branches and even more code.

    So the trick to work around that is simply... to shift twice ! One time for the first bit, and another for the last (potential 7):

    (myu8 >> 1) >> (8 - shift - 1)

    And that's how one can do this operation fully branchless.

    (another version of this post appeared on a now-defunct instance)

    #RustLang #bitmap #BitManip

  10. Nice! #LLVM can now assemble and disassemble #RISCV with #BitManip extensions:

  11. Gestern ist das Buch mit den Bitzaubersprüchen angekommen. Da muss man als Softwareentwickler einfach mal drin schmökern. Bevor es verboten wird, weil derartiges Wissen nur noch der KI vorbehalten ist.🤣

    Da stehen ohne Ende so Sachen drin wie:

    "Use the following formula to turn off the rightmost 1-bit in a word, producing 0 if none (e.g., 01011000 01010000):
    x & (x – 1)"

    Wobei x ein 32Bit-Wert ist.

    #hacker #hackersDelight #programming #bitmanipulation

  12. ☑️ Day 40/100: #Leetcode daily question

    🟨 Question: 2275. Largest Combination With Bitwise AND Greater Than Zero

    This was an easy one for medium and I solved it using index bit count.

    🐈‍⬛ Check out my #GitHub where I post all the daily streak 🔥 questions and #LeetcodeContest 🏆 solutions

    🔗 Solution Link: github.com/akshatsingh1718/lee

    🔗 My Leetcode Github: github.com/akshatsingh1718/lee

    #Algorithms #coding #python #bitmanipulation

  13. ☑️ Day 39/100: #Leetcode daily question

    🟨 Question: 3011. Find if Array Can Be Sorted

    This was an easy one for medium and I solved it using bubble sort.

    🐈‍⬛ Check out my #GitHub where I post all the daily streak 🔥 questions and #LeetcodeContest 🏆 solutions

    🔗 Solution Link: github.com/akshatsingh1718/lee

    🔗 My Leetcode Github: github.com/akshatsingh1718/lee

    #python #Algorithms #coding #sorting #bitmanipulation

  14. 🧑‍🎓Learning new things on
    #leetcode is essential! 🚀 Today, from #Leetcode2220, I discovered Brian Kernighan’s Algorithm, which efficiently counts #setbits (bits set to 1) in nearly O(1) 🔥 time ⌛. Super handy for #bitmanipulation! 💡 #LeetCode #Coding #Algorithms #python

  15. 🧑‍🎓Learning new things on
    #leetcode is essential! 🚀 Today, from #Leetcode2220, I discovered Brian Kernighan’s Algorithm, which efficiently counts #setbits (bits set to 1) in nearly O(1) 🔥 time ⌛. Super handy for #bitmanipulation! 💡 #LeetCode #Coding #Algorithms #python

  16. 🧑‍🎓Learning new things on
    #leetcode is essential! 🚀 Today, from #Leetcode2220, I discovered Brian Kernighan’s Algorithm, which efficiently counts #setbits (bits set to 1) in nearly O(1) 🔥 time ⌛. Super handy for #bitmanipulation! 💡 #LeetCode #Coding #Algorithms #python

  17. 🧑‍🎓Learning new things on
    #leetcode is essential! 🚀 Today, from #Leetcode2220, I discovered Brian Kernighan’s Algorithm, which efficiently counts #setbits (bits set to 1) in nearly O(1) 🔥 time ⌛. Super handy for #bitmanipulation! 💡 #LeetCode #Coding #Algorithms #python

  18. 🧑‍🎓Learning new things on
    #leetcode is essential! 🚀 Today, from #Leetcode2220, I discovered Brian Kernighan’s Algorithm, which efficiently counts #setbits (bits set to 1) in nearly O(1) 🔥 time ⌛. Super handy for #bitmanipulation! 💡 #LeetCode #Coding #Algorithms #python

  19. Second year in a row that I have spatchcock’d the turkey and I am a believer! So good. (But Bitman is cray if he thinks it cooks in 45 minutes…) Happy #Thanksgiving! #Turkey #spatchcock