Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by Catafriggm

  1. As far as I can tell, there are no instructions in the various SSE versions to do a bit shift by a non-uniform amount. E.g.: o0 = i0 << n0 o1 = i1 << n1 o2 = i2 << n2 o3 = i3 << n3 There are only functions to shift all packed members by a single amount (e.g. n0 = n1 = n2 = n3). Are there any relatively fast ways to emulate this behavior? By "fast" I mean much faster than extracting each packed member and performing the shifting on the main CPU ALU.
  2. Catafriggm

    SSE Bit Shift?

    Ugh. 4 separate shifts is slow. In this algorithm I was trying to make an SSE version of, the functions I wrote which act like an SSE version of ROL take 68% of the running time; in contrast, the multiply function which does 4x4 int32 multiplication (using several multiplies and shuffles), takes 18%, and the rest (a combination of arithmetic, logical, and uniform shift ops) takes the remaining 14%. So yeah, using 4 separate shifts is very slow. At least 10x as slow as uniform shifting.
  3. Catafriggm

    Simple N00b C# Question

    I'm in need of a data structure that stores a set of objects of a given type without allowing duplicates, and supports fast insert, delete, and test for a specific item in the collection. In the general case I can't rely on things like the values of each object being unique (e.g. for a GetHashCode implementation or assigning a unique key to each object). Is there some stock way to do this? If not, I could make one easy enough if there was a way to either order raw references (to make a binary search tree; Object.ReferenceEquals is similar, but only tests for equality) or get a hash of a reference (to make a hash table). Do either of those things exist?
  4. Catafriggm

    Simple N00b C# Question

    Quote:Original post by Zahlman (The default "hash code" is, basically, the "location in memory" of the object - although that concept is heavily abstracted by both the virtual machine and the OS. Anyway, the point is that two objects which are not *the same object* will always be considered not-equal - and further, one will be consistently considered "less than" the other, although the decision is somewhat arbitrary - even if they hold the same *data*.) That's exactly what I needed to know. Thanks!
  5. Catafriggm

    Simple N00b C# Question

    Quote:Original post by TheTroll Now what I don't understand is why you can't come up with a unique hash. In your first post you said that the object you are storing needs to make sure it is not a duplicate, so if it is not the same then you should be able to make unique hashes. The values of the object will be changing. A hash code of an object suddenly changing while it's in the table would break any hash table implementation. Besides that, "duplicate", in this case, is referring to multiple references to the same instance of a class. There is no data in the class itself that is unique to one instance compared to any other. These are the same reasons why I can't simply compare them member-wise.
  6. Catafriggm

    Simple N00b C# Question

    Quote:Original post by TheTroll Well if you know the answer then why are you asking us mere mortals? What I don't know: - Is there a way to do <, > on references (rather than the contents of the objects themselves)? The <, > don't need to have any particular meaning other than that if A < B at one point, A < B at some later point, after various members of both have changed. - Does GetHashCode (or some other hash provider) return something that can reliably be used in a hash table, and is based on the reference itself, rather than the contents of the item? E.g. garbage collection will move things around; will the hash code change on GC? Is the hash code more or less evenly distributed among values for raw references? Will the hash code change if the members in the object referenced change? What I do know: - Dictionary is fast (O(1)). But I would need the ability to generate a hash code for a raw reference. - SortedDictionary is also fast (O(log N)). But I would need a way to do <, > for a raw reference. Cygon: Ehhh. I suppose if I can't find anything better I could assign each entry in the list a random number to use as the hash key. It would be ugly, but I suppose it would work. Thx for the info.
  7. Catafriggm

    Simple N00b C# Question

    Sorted dictionary is a binary search tree. Though even if it wasn't, as I mentioned in the opening post, such a tree would be trivial to implement if it were possible to compare references for greater/less than (which I'm hoping one of you will know how to do). There's also Dictionary (hash table), but that requires the ability to get reliable hashes for an object based just on its reference (also mentioned, and also not something I know how to do).
  8. Catafriggm

    Simple N00b C# Question

    Uhh... List? That's an array. In other words O(N) insert, delete, and search (without a way to compare elements the list couldn't be sorted; and if we could compare elements there are faster data structures). Not exactly fast.
  9. Catafriggm

    Asynchronous IPC WIndows

    Windows objects are reference-counted, so it's impossible to have an object stay in existence with no processes using it. You'd have to save it to a file, the registry, or have a host process keep the thing open until the next process comes along.
  10. ...if there's a non-copula verb in the name, chances are extremely high that it's a function. Nothing unique to Windows or anything.
  11. They're different. GetCurrentThread returns a HANDLE (void *) which is a constant. GetCurrentThreadId returns a DWORD, which is not constant.
  12. You are calling GetCurrentThread, as I warned you about not doing.
  13. DON'T use GetCurrentThread. That returns a constant that tells the kernel to use the current thread handle. GetCurrentThreadId gets the ID from the thread environment block (FS), as he said, so it should be fast. Thread local storage is fast, at least on Windows. TLS is just an array of pointers, the array address being pointed to by the TEB for the current thread.
  14. Christian... Edition... You know this Linux distribution business has gotten out of hand when religions have their own versions of Linux (derived from another distribution, no less). And don't forget the absence of the kill signal :P
  15. Catafriggm


    For the SSE2 instructions I used, Intel C++, Visual C++, and G++ all supported them.
  16. Catafriggm


    Would I be correct in recommending compiler intrinsics rather than assembly, as inline assembly format (or even support) varies by compiler, and using the compiler intrinsics allows compiler optimization? Although I guess portability's not so important if you're not making library code for reuse (like I am).
  17. As far as I know, most Windows controls are implemented in user mode. Not sure about how it handles password text boxes, though.
  18. Catafriggm

    Name That License

    For the case of a portion of the code (this is a program, not a library, by the way) being used in an unrelated program, does the LGPL require the binary of that program credit the project of the borrowed code?
  19. Quote:Original post by DaivukNot sure to understand what you mean. Isn't going to the server? If the hacker block the message being sent, the server will still wait for it, and kick the player. The hacker could just sent the correct CRC. Emulating a state that the game isn't actually in isn't a new trick in the hacker's book.
  20. ...and what about the fact that the CRC code isn't going anywhere?
  21. Or you could use public key encryption on all data files, and make it impossible to disable the hash checking (since there wouldn't be a hash needing to be checked). That doesn't change the fact that they can load the data another way (the data doesn't have to come from the archives, you know - regardless of how you coded it).
  22. Short answer: you can't prevent the user from editing the data files. You could use asymmetric encryption, where the data files are encrypted with your private key, but then the user could just edit the binary and replace the private key (or even intercept the request to load the file, and load it from somewhere else). If you want to prevent cheating, you'll need another method - one that isn't client-side.
  23. Catafriggm

    How to save a device context ?

    I'd recommend using a bitmap section. That would allow you to save it, be good coding style, and probably be way faster than what you're doing.
  24. Quote:Original post by Alpha_ProgDes <offtopic range="slightly"> Is there a programming methodology that has you send data to the thread as opposed to the threads locking that data? </offtopic> Message passing. Windows and OS X are heavily based on this (I couldn't say about other OS for sure). And you could sort of say that's how the Cell's SPEs work. [Edited by - Catafriggm on January 17, 2007 2:07:14 PM]
  25. Quote:Original post by Telastyn Raw processing power does not make a game good or even financially viable. Your mission: make a blockbuster PS3 game that uses only the PPE. Ready? Go!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!