Content Warning

CONTENT WARNING

You may view NSFW content!

If you are under 18 years old you are not allowed to continue!

Lemmy.NRDBLG.de
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
cm0002@lemmy.world to Programmer Humor@programming.dev · 1 year ago

Tell me the truth ...

piefed.jeena.net

message-square
15
link
fedilink
0

Tell me the truth ...

piefed.jeena.net

cm0002@lemmy.world to Programmer Humor@programming.dev · 1 year ago
message-square
15
link
fedilink
alert-triangle
You must log in or # to comment.
  • Skullgrid@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    just like electronic components, they sell the gates by the chip with multiple gates in them because it’s cheaper

  • Lucy :3@feddit.org
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    Then you need to ask yourself: Performance or memory efficiency? Is it worth the extra cycles and instructions to put 8 bools in one byte and & 0x bitmask the relevant one?

    • Nat (she/they)@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      A lot of times using less memory is actually better for performance because the main bottleneck is memory bandwidth or latency.

  • 𝕲𝖑𝖎𝖙𝖈𝖍🔻𝕯𝖃 (he/him)@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 year ago

    if wasting a byte or seven matters to you, then then you need to be working in a lower level language.

    • MystikIncarnate@lemmy.ca
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 year ago

      It’s 7 bits…

      Pay attention. 🤪

      • JasonDJ@lemmy.zip
        link
        fedilink
        arrow-up
        0
        ·
        1 year ago

        7 bytes! Look at Mr. Moneybags here!

  • kiri@ani.social
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    I have a solution with a bit fields. Now your bool is 1 byte :

    struct Flags {
        bool flag0 : 1;
        bool flag1 : 1;
        bool flag2 : 1;
        bool flag3 : 1;
        bool flag4 : 1;
        bool flag5 : 1;
        bool flag6 : 1;
        bool flag7 : 1;
    };
    

    Or for example:

    struct Flags {
        bool flag0 : 1;
        bool flag1 : 1:
        int x_cord : 3;
        int y_cord : 3;
    };
    
  • kayzeekayzee@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 year ago

    Redundancy is nice in the event of bitflip errors

  • ricecake@sh.itjust.works
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    I set all 8 bits to 1 because I want it to be really true.

    • Consti@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      I was programming in assembly for ARM (some cortex chip) and I kid you not the C program we were integrating with required 255, with just 1 it read it as false

    • laranis@lemmy.zip
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      01111111 = true

      11111111 = negative true = false

      • StellarSt0rm@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        1 year ago

        00001111 = maybe

        • ThatGuy46475@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          1 year ago

          10101010 = I don’t know

          • assa123@lemmy.world
            link
            fedilink
            arrow-up
            0
            ·
            1 year ago

            00000001 00000000 00001111 10101010

    • palordrolap@fedia.io
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      You jest, but on some older computers, all ones was the official truth value. Other values may also have been true in certain contexts, but that was the guaranteed one.

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 346 users / day
  • 4.14K users / week
  • 5.9K users / month
  • 5.99K users / 6 months
  • 1 local subscriber
  • 31.4K subscribers
  • 236 Posts
  • 2.02K Comments
  • Modlog
  • mods:
  • adr1an@programming.dev
  • Feyter@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.17
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org