this post was submitted on 18 Oct 2023
6 points (100.0% liked)

Programming

19623 readers
73 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
 

I don’t remember the first time I saw this word but I suspect the word multiplex is not the proper one. How would you name this:

Shot name is multiplexed as 15:17, where:
* The first 15 bits stores the sequence number.
* The last 17 bits stores the shot number.

Thanks in advance!

EDIT: Thanks all! So it seems packed is the proper word. With pack/unpack being the name of the process.

top 8 comments
sorted by: hot top controversial new old
[–] [email protected] 12 points 2 years ago (1 children)

I've seen this referred to as a "packed" field in some cases.

[–] [email protected] 5 points 2 years ago* (last edited 2 years ago) (1 children)

Yeah that’s a good suggestion. A common way to refer to low-level memory structures e.g. C structs. Bit packing, padding, and alignment.

https://en.m.wikipedia.org/wiki/Data_structure_alignment

[–] [email protected] 1 points 2 years ago

Mandatory link when we talk about padding and alignment: The Lost Art of Structure Packing.

[–] [email protected] 3 points 2 years ago

I usually call it a bit stream or a bit field.

Shot name is stored as a 32-bit big endian integer where:

  • The first 15 bits stores the sequence number.
  • The last 17 bits stores the shot number.
[–] coloredgrayscale 2 points 2 years ago (1 children)

(time) Multiplex would be if you only had a single 17bit field and alternate the two elements.

[–] o11c 1 points 2 years ago

Time-division isn't the only kind of multiplexing ... but I guess most of the others already have more specific names.

[–] [email protected] 2 points 2 years ago

I'd use 'encoded as 15:17', or 'packed' is fine here as well.

I'd also recommend being explicit about which 15 and 17 bits are used rather than using 'first' and 'last', because that may mean different things depending on the platform endianness. You could say 'Bits 0:14 store the sequence number, while bits 15:31 store the shot number'. That makes it far easier to reason about how to access each piece of data in the combined 32 bits.

[–] RonSijm 1 points 2 years ago* (last edited 2 years ago)

I suppose multiplexing could be considered the right name.. multiplexing is putting two signals into a single one. So by the example, if you pack 15 and 17 into a single 32 bit, it's kind of multiplexing.

Especially if you send it as one thing, and unpack it later, which would be the demultiplexing