Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: Buffer.add_byte #8049

Closed
vicuna opened this issue Mar 7, 2003 · 1 comment
Closed

feature request: Buffer.add_byte #8049

vicuna opened this issue Mar 7, 2003 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Mar 7, 2003

Original bug ID: 1578
Reporter: administrator
Status: closed (set by @xavierleroy on 2013-08-31T10:46:12Z)
Resolution: suspended
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Eric Cooper
Version: 3.06
OS: linux
Submission from: 12-227-100-158.client.attbi.com (12.227.100.158)

Please add the function

val add_byte : t -> int -> unit

to the Buffer module, where (add_byte buf n) is equivalent to
(add_char buf (Char.chr n)), but hopefully more efficient.

I wouldn't mind if only the low 8 bits of n are stored, using %string_safe_set.
Thanks for considering this.

@vicuna
Copy link
Author

vicuna commented Jan 26, 2012

Comment author: @damiendoligez

The cost of Char.chr is only two comparisons with constants, so it is probably not worth the trouble of using %string_safe_set (which is not documented to truncate its input).

Whatever the implementation, do we want to provide add_byte in buffer.mli? There doesn't seem to be much demand for it.

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

No branches or pull requests

1 participant