C code:
static inline void memfill32(uint32_t* dest, uint32_t value, int length)
{
for(int i = 0;i < length;i++)
dest[i] = value;
}
FB converted code:
private sub memfill32(byval dest as ulong ptr, byval value as ulong, byval length as long)
For i As integer = 1 to length ' hope this line is correct related to the below line
dest[i] = value; 'No idea how to convert could not find any clue even in rossetta code
Next
end sub
C code
font_data_t* font_data_reference(font_data_t* idata)
{
if(idata == NULL)
return NULL;
++idata->ref;
return idata;
}
possible FB converted :
function font_data_reference(byval idata as font_data_t ptr) as font_data_t ptr
if idata = NULL then
return NULL
end if
++idata->ref; ' No clue how to convert the pre- increment
return idata
end function
In general i have no clue how to handle the pre-increment for next loop procedure.
C code:
static inline void memfill32(uint32_t* dest, uint32_t value, int length)
{
for(int i = 0;i < length;i++)
dest[i] = value;
}
FB converted code:
private sub memfill32(byval dest as ulong ptr, byval value as ulong, byval length as long)
For i As integer = 0 to length - 1 ' Nope; this is how you port that C idiom to FreeBasic
dest[i] = value 'Because you should look at the manual and not Rosetta Code ;)
Next
end sub
C code
font_data_t* font_data_reference(font_data_t* idata)
{
if(idata == NULL)
return NULL;
++idata->ref;
return idata;
}
possible FB converted :
function font_data_reference(byval idata as font_data_t ptr) as font_data_t ptr
if idata = NULL then
return NULL
end if
idata->ref += 1 ' In this case it doesn't matter if it's pre or post increment; just increment it
return idata
end function
In general i have no clue how to handle the pre-increment for next loop procedure.