Re: How to read string slices as integers performantly?

2018-08-14 Thread cdome
These days it is possible that toOpenArray will also be handy to avoid copies. It is untested idea.

Re: How to read string slices as integers performantly?

2018-08-14 Thread tim_st
The link was indeed very helpful, so I used the following: >From T to string: result = "" var t: T var fromTtoString = cast[ptr array[sizeof(T), char]](unsafeAddr(t))[] for c in fromTtoString: result.add(c) Run >From string to T: var

Re: How to read string slices as integers performantly?

2018-08-13 Thread tim_st
Thanks, that's exactly what I needed!

Re: How to read string slices as integers performantly?

2018-08-13 Thread lucian
see: [https://forum.nim-lang.org/t/2626](https://forum.nim-lang.org/t/2626) for a similar question.

How to read string slices as integers performantly?

2018-08-12 Thread tim_st
Assuming I have a string var x = "" Run of length 16. I want to read the chars "" as int32, the chars "" as int64 and the chars "" as int32. What would be the most performant way to read these 3 slices into the int types if I know