Skip to content

Instantly share code, notes, and snippets.

View odeheurles's full-sized avatar

Olivier Deheurles odeheurles

View GitHub Profile
@odeheurles
odeheurles / Assembly optimized
Created December 14, 2013 10:49
Example of inlining with Simple Binary Encoding
80: car.SerialNumber = 1234;
mov edx,dword ptr [esi+8]
mov ecx,dword ptr [esi+18h]
mov eax,dword ptr [edx+8]
mov dword ptr [eax+ecx],4D2h
81: car.ModelYear = 2013;
mov edx,dword ptr [esi+8]
mov ecx,dword ptr [esi+18h]
add ecx,4
mov eax,dword ptr [edx+8]
private static int Encode(Car car, DirectBuffer directBuffer, int bufferOffset)
{
...
car.SerialNumber = 1234;
car.ModelYear = 2013;
car.Available = BooleanType.TRUE;
car.Code = Model.A;
...
}
80: car.SerialNumber = 1234;
mov rax,qword ptr [rbp+100h]
cmp byte ptr [rax],0
mov rcx,qword ptr [rbp+100h]
mov edx,4D2h
call 000007FE8C96CB40 // function call
nop
81: car.ModelYear = 2013;
mov rax,qword ptr [rbp+100h]
cmp byte ptr [rax],0
80: car.SerialNumber = 1234;
mov edx,dword ptr [esi+8]
mov ecx,dword ptr [esi+18h]
mov eax,dword ptr [edx+8]
mov dword ptr [eax+ecx],4D2h
81: car.ModelYear = 2013;
mov edx,dword ptr [esi+8]
mov ecx,dword ptr [esi+18h]
add ecx,4
mov eax,dword ptr [edx+8]
order.orderId(72);
sbe_uint32_t serialNumber(void) const
{
return SBE_LITTLE_ENDIAN_ENCODE_32(*((sbe_uint32_t *)(buffer_ + offset_ + 0)));
}
public int getInt(final int index, final ByteOrder byteOrder)
{
int bits = UNSAFE.getInt(byteArray, baseOffset + index);
if (NATIVE_BYTE_ORDER != byteOrder)
{
bits = Integer.reverseBytes(bits);
}
return bits;
}
public unsafe int Int32GetLittleEndian(int index)
{
return *(int*)(_pBuffer + index);
}
@odeheurles
odeheurles / RFQStates
Created June 21, 2014 07:47
Possible states for a RFQ
public enum RfqState
{
Input,
Requesting,
Cancelling,
Cancelled,
Quoted,
Executing,
Error,
Done
@odeheurles
odeheurles / RfqEvent
Created June 21, 2014 07:49
Possible RFQ Events
public enum RfqEvent
{
UserRequests,
UserCancels,
UserExecutes,
ServerNewQuote,
ServerQuoteError,
ServerQuoteStreamComplete,
ServerSendsExecutionReport,