librasn / rasn

A Safe #[no_std] ASN.1 Codec Framework
Other
199 stars 50 forks source link

Move some generally useful functions from PER to utility module #190

Closed Nicceboy closed 11 months ago

Nicceboy commented 11 months ago

I think these functions (log2, to_vec etc.) might be better located on utils.rs or something similar, since they are not codec specific. For example, OER needs them as well.

XAMPPRocky commented 11 months ago

Thank you for your PR! The only thing I would change is that I wouldn't have a single utils module. I don't like those because it's too generic, anything could be put there.

I would instead make two modules num and bits. I would move log2 to num, the rest to bits and rename range_from_bits to range_from_len.

Nicceboy commented 11 months ago

I made the change. Should these have own directory as well or current is good?

XAMPPRocky commented 11 months ago

I don't think we need them to have a directory unless they have sub modules.