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
#!/usr/bin/perl | |
use strict; | |
# Kind of useless script to convert numbers to their word equivalent and back | |
# Call dec_to_str() with a decimal value, returns a string containing the word equivalent | |
# eg. dec_to_str(123456) := one hundred and twenty three thousand four hundred and fifty six | |
# Call str_to_dec() with a number in words, returns decimal value |
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 <libxml/parser.h> | |
/* compile: | |
gcc -m32 libxml_error.c `xml2-config --libs` `xml2-config --cflags` -Wall -Wextra -pedantic | |
*/ | |
/* example xml input file | |
<?xml version="1.0"?> | |
<A> |
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
#!/usr/bin/perl | |
use strict; | |
use Data::Dumper; | |
my @b = (['a','b'],['c','d'],['e','f']); | |
my @all; | |
my @single; | |
&rec(0, \@all, \@single, @b); |
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
%% This BibTeX bibliography file was created using BibDesk. | |
%% http://bibdesk.sourceforge.net/ | |
%% Created for dave stevens at 2012-03-21 13:28:29 +0000 | |
%% Saved with string encoding Unicode (UTF-8) | |
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
!! Instructions for adding assembly code for leon3mp to setup stack pointers for each available CPU. | |
!! Running sparc-elf-gcc includes some system files in the final elf file, but editing these it is possible to set the stack pointer for each CPU before main is entered. | |
!! Edit the file sparc-elf-*.*.*/src/libgloss/sparc_leon/crt0.s | |
!! Add in the following assembly beneath the _start: label | |
! added code for setting stack pointer for each cpu | |
rd %asr17, %g5 ! load in configuration reg into g5 | |
srl %g5, 28, %g5 ! shift so only cpuid is seen |
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 <stdlib.h> | |
typedef struct elementT { | |
unsigned value; | |
struct elementT *next; | |
} elementT; | |
elementT *removeElement(elementT *, unsigned); | |
elementT *addElement(elementT *, unsigned); |
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
<html> | |
<head> | |
<script src="jquery.min.js"></script> | |
<script> | |
var rah; | |
var output = []; | |
/* i would assume that output would be the same as input | |
but the outcome is the a->a2->a3->a4 rather than a->a2, a->a3, a->a4 | |
*/ |
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
/* | |
This is a stripped down piece of code from a code generator. | |
It works in GCC but with another compiler I'm using is fails, its a real corner case though. | |
If there was only one struct (structure) then it wouldn't be a problem, when there is more than one it messes up. | |
The fact that the static structures foo and bar are defined and then redefined causes a problem in the assembly output. GCC doesn't seem to mind this and the function pointer is correct. The VEX assembly will output 2 memory areas with the same tag, one empty and one with the correct data. | |
Question: what should be the proper behaviour of this? The code is technically redefining the structures, but GCC gives no compiler warnings? Are structs different for defining? | |
Or would you say this is bad coding? | |
*/ | |
typedef struct structure { |
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
int unsignedRightShift(int input, char shift) { | |
if(shift == 0) { | |
return input; | |
} | |
return (((input >> 1) & 0x7fffffff) >> (shift - 1)); | |
} |
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 <iostream> | |
#include <stdlib.h> | |
using namespace::std; | |
class testClass { | |
public: | |
string myString1; | |
char *myString2; | |
unsigned myInt; | |
testClass(); |