This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <float.h> | |
#define INF 1.0/0.0 | |
float calcMinFloat(); | |
float calcFloatErr(); | |
float calcMaxFloat(); | |
int main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <float.h> | |
float calcMinFloat(); | |
int main() | |
{ | |
float f; | |
f = FLT_MIN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Exercise 2-6. Write a function setbits(x,p,n,y) that returns x with the n bits that begin at position p set to the rightmost n bits of y, leaving the other bits unchanged. | |
*/ | |
unsigned int setbits(unsigned int x, int p, int n, unsigned int y) | |
{ | |
// get n right-most bits of y only | |
y = ~(~0 << n) & y; | |
// shift those n bits p-n bits to the left | |
y = y << (p-n); | |
// zero out n bits of x starting at p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl -MDigest::SHA -le '$h = substr( Digest::SHA::sha1_hex($ARGV[0]) , 5 ); open F, "<SHA1.txt"; do { print "found $_" if grep(/$h/, $_) } while (<F>)' fuckyou | |
found 00000b87ea9eb7a32fd4057276d3a1fab861c1d5 | |
$ perl -MDigest::SHA -le '$h = substr( Digest::SHA::sha1_hex($ARGV[0]) , 5 ); open F, "<SHA1.txt"; do { print "found $_" if grep(/$h/, $_) } while (<F>)' fuckoff | |
found 0000007681665f3dc017ebcab0c4cd7b1733e102 | |
$ perl -MDigest::SHA -le '$h = substr( Digest::SHA::sha1_hex($ARGV[0]) , 5 ); open F, "<SHA1.txt"; do { print "found $_" if grep(/$h/, $_) } while (<F>)' goddamnit | |
found 00000de322068568e53b8b1ade5f09c1685cf1ed | |
$ perl -MDigest::SHA -le '$h = substr( Digest::SHA::sha1_hex($ARGV[0]) , 5 ); open F, "<SHA1.txt"; do { print "found $_" if grep(/$h/, $_) } while (<F>)' imfucked |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ParcelableMessage implements Parcelable { | |
public int messageType; | |
public byte[] protoBytes; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static MessageMicro getProto(ParcelableMessage message) { | |
switch (message.messageType) { | |
case ALPHA : | |
return Alpha.AlphaParser.parse(response.protoBytes); | |
case BETA : | |
return Beta.BetaParser.parse(response.protoBytes); | |
default : | |
return null; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ParcelableMessage implements Parcelable { | |
public int messageType; | |
public byte[] protoBytes; | |
private MessageMicro mProto; | |
public MessageMicro getProto() { | |
if (mProto == null) { | |
mProto = getProto(this); | |
} | |
return mProto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ParcelableMessage<T extends MessageMicro> implements Parcelable { | |
public int messageType; | |
public byte[] protoBytes; | |
private T mProto; | |
public T getProto() { | |
if (mProto == null) { | |
mProto = getProto(this); | |
} | |
return mProto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ParcelableMessage<Alpha> alpha = ... | |
Alpha a = alpha.getProto(); |