Search:

Type: Posts; User: cyberfish

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    6
    Views
    518

    Yeah that would be nice! This is a whole...

    Yeah that would be nice!

    This is a whole 'nother level of hacky, but it worked!



    BufferedOutputStream& operator<<(
    std::ostream& (*manipulator)(std::ostream&)) {
    using char_type =...
  2. Replies
    3
    Views
    333

    This works because of the same thing I just...

    This works because of the same thing I just realized in my own reply above - the standard guarantees that casting a signed type to unsigned preserves the bit pattern in 2's complement (and...
  3. Replies
    3
    Views
    333

    Ah actually disregard. static_cast would do it....

    Ah actually disregard. static_cast<> would do it. I thought it was technically undefined but it isn't!
  4. Replies
    3
    Views
    333

    Converting signed to unsigned

    Is there a way to store the absolute value of a signed value into an unsigned type of the same size? I don't want to use a larger type, because this is a template function that will need to work with...
  5. Replies
    6
    Views
    518

    Yeah but then when they try

    Yeah but then when they try << std::endl, they get a cryptic error message, since most people don't actually know how IO manipulators work under the hood - a function pointer that takes a pointer to...
  6. Replies
    6
    Views
    518

    Because many of the users of my libraries will be...

    Because many of the users of my libraries will be reasonably new to C++, so I want to make it behave as much like std::iostream as possible, for simple use cases, from the user's perspective.
  7. Replies
    6
    Views
    518

    Handling std::endl without std::ostream

    I am working on an alternative implementation of input/output streams that have similar semantics to std::istream and std::ostream (for size reasons - on my microcontroller instantiating an...
  8. Yeah definitely. I was reading an article on tips...

    Yeah definitely. I was reading an article on tips on how to use iostreams, before realizing it was actually written in the early 1990s before standardization! And they have stayed more or less the...
  9. As it turned out, I still had to derive from both...

    As it turned out, I still had to derive from both streambuf and iostream, because readsome() is the only non-blocking call supported by the iostream interface, and it's seriously inadequate. There...
  10. I am still in the early planning stages so...

    I am still in the early planning stages so unfortunately not.



    Yeah, it's looking like providing a streambuf for the user to wrap in her own iostream is a better way to go.

    By async IO I...
  11. Inheriting from basic_iostream and streambuf

    Hello!

    I am writing a library for an embedded system where I want to provide the user with an std::basic_iostream interface to some peripheral (let's say an UART).

    The straightforward way to do...
  12. Ah! That makes sense. I think I can work it...

    Ah! That makes sense.

    I think I can work it out from type traits and enable_if. Just needed the hint.

    Thanks!
  13. Multiple template specializations with the same body

    Is it possible to do template specializations with the same body for unrelated types?



    template <typename T>
    void f(T &x) { ... default implementation }

    template<>
    void f(A &x) { ......
  14. Awesome thanks! Yeah I was mostly worried about...

    Awesome thanks! Yeah I was mostly worried about the cache behaviour, and using buckets does solve that! Will give it a try.
  15. Drawing multiple samples from a discrete probability distribution

    Given a list of pairs (value and probability), what's a fast way to draw many samples from the distribution?

    For example, the input could be something like -

    <"bob", 0.25>
    <"cindy", 0.5>...
  16. Replies
    103
    Views
    9,731

    I have always been jealous of people who can...

    I have always been jealous of people who can cook... I can only cook things with up to 4 ingredients, and I count water as an ingredient!
  17. Replies
    6
    Views
    1,135

    Assuming you have the latest Pentium 4...

    Assuming you have the latest Pentium 4 (Prescott), one core in the latest i5/i7 would be about 3.5x faster at the same clock speed.

    Prescott to Conroe (Core 2 architecture) is where the big jump...
  18. Replies
    14
    Views
    1,266

    Ah! Good old CUDA. The constants are...

    Ah! Good old CUDA.

    The constants are 0x155555..., so it basically shifts the number by all even amounts, then xor them together. And to make sure the lower bits aren't too static, the upper bits...
  19. Replies
    14
    Views
    1,266

    That seems fast enough (extended to 64-bit)....

    That seems fast enough (extended to 64-bit). What's the story behind that?
  20. Thread: Won't boot.

    by cyberfish
    Replies
    15
    Views
    1,283

    That sounds like the problem was somewhere else....

    That sounds like the problem was somewhere else. Probably a lose connection somewhere that happened to be fixed when you replugged things in.

    PSUs don't care which way they are mounted. They are...
  21. Replies
    14
    Views
    1,266

    I have read your example multiple times, and...

    I have read your example multiple times, and still don't think I get it.

    Are you essentially trying to say Table[3][1 << 15] can happen to be equal to Table[3][0]? Because that's the only case the...
  22. Replies
    14
    Views
    1,266

    Is there a theoretical basis for this being a bad...

    Is there a theoretical basis for this being a bad thing?

    In this case, I wouldn't say the higher bits are excluded from changing the computed hash. If they were different, the computed hash would...
  23. Replies
    14
    Views
    1,266

    I have never heard of it but just looked it up....

    I have never heard of it but just looked it up. Pretty cool!

    It does seem to be a little too slow, though.
  24. Replies
    14
    Views
    1,266

    Thanks, will definitely give that a try. Is...

    Thanks, will definitely give that a try.

    Is there anything fundamentally wrong with not using bits in the input, if it satisfies all the properties of a good hash (or is there a property that...
  25. Replies
    14
    Views
    1,266

    Also, the input domain is numbers with up to 8...

    Also, the input domain is numbers with up to 8 arbitrary bits set.
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4