search for: reinterpret

Displaying 20 results from an estimated 95 matches for "reinterpret".

2012 Dec 25
2
reinterpreting externalptr in R
Hi, I am using swig to build a wrapper for an c-function to use it in R. I would like to define a generic function, which gives back a void pointer. On the R side, I know what this pointer is pointing to, whether it is an integer or an string, or something else... but I need to somehow reinterpret the resulting "externalptr" into another form... a function that looks like the following: *void* test(){ std::string str="test"; return str.c_str(); }* when I call this from R: *str <- test() typeof(str) % result is: "externalptr"* how could I reinterp...
2024 Jul 14
2
Reinterpret data without saving it to a file 1st? Check for integer stopping at 1st decimal?
A small number of columns in the data I need to work with are strings, the rest numbers. I'm using read_excel() from the readxl package to get the data ; right after it, the string columns are of type chr and the rest num. I'm tasked with finding out which columns are integers. From an advice, I tried saving the spreadsheet content into a CSV then loading that, which works like a charm ;
2011 Sep 22
2
[LLVMdev] Need help in converting int to double
On Sep 22, 2011, at 3:32 AM, James Molloy wrote: > It’s in trouble by this point because it needs to do a fptosi on a double operand, but you’ve got an i64 operand and you can’t reinterpret-cast ints to floats in LLVM IR (AFAIK) You can bitcast ints to floats and vice-versa if they're the same size — for example, i32 to float and i64 to double. John.
2020 Sep 06
8
some questions about R internal SEXP types
...d, meaning that the tail of the list is all LISTSXP. Is this correct? The last question is more a question of interest in design strategy, and the answer may have been lost to time. In order to reduce the need to go through Go's interface assertions in a number of cases I have decided to reinterpret R_NilValue to an untyped Go nil (this is important for example in list traversal where the CDR can (hopefully) be only one of two types LISTSXP or NILSXP; in Go this would require a generalised SEXP return, but by doing this reinterpretation I can return a *List pointer which may be nil, greatly si...
2009 Jul 20
2
[LLVMdev] PIC16TargetAsmInfo::getBSSSectionForGlobal
Hi Sanjiv, The PIC16TargetAsmInfo::getBSSSectionForGlobal apparently does magic that reinterprets the "section" field of a global in a strange way: // If GV has a sectin name or section address create that section now. if (GV->hasSection()) { std::string SectName = GV->getSection(); // If address for a variable is specified, get the address and create...
2013 Oct 29
2
[LLVMdev] Missed optimization opportunity with piecewise load shift-or'd together?
...t; change what instructions are used based on target platform and its > endedness. One reason for writing code like this, i.e. explicitly spelling out the accesses to the individual bytes, would be to allow compile-time evaluation of the fragment in the D programming language, where arbitrarily reinterpreting memory is not supported (although integer->integer pointer casts might be supported at some point). Would a patch adding the capability to lower this to InstCombine or similar have a chance of being accepted, or would that be considered to be too rare a spacial case to be worth the added com...
2020 Jul 02
3
Redundant ptrtoint/inttoptr instructions
My general feeling is this: No optimizations should be creating int2ptr/ptr2int. We really need to fix them all. They should use pointer casts and i8* GEPs. This has, unfortunately, been a problem for a long time. As Johannes says, optimizing int2ptr/ptr2int is very tricky. In part, becaue all dependencies, including implicit control dependencies, end up being part of the resulting aliasing
2010 Jun 02
2
[LLVMdev] Generating Floating point constants
Hi, We need to generate "Floating point constants" in our code. In http://llvm.org/docs/LangRef.html it is explained that FP has to follow special encoding rules to be handled by LLVM later one (hexadecimal coding...) Is there any code available in LLVM to handle this kind of "standard float to LLVM float" conversion? Thanks. Stéphane Letz
2010 Jun 02
0
[LLVMdev] Generating Floating point constants
...C++ code, just stick your float into an APFloat and doesn't worry about the hexadecimal coding. If you're generating textual IR, and you don't care about the precise hexadecimal representation, AFAIK just printing a decimal float works. If you really want a hexadecimal encoding, just reinterpret the floating-point number as an integer and print in hexadecimal; an "LLVM float" is just an IEEE float printed in hexadecimal. -Eli
2018 Nov 30
2
[PATCH RFC 00/15] Zero ****s, hugload of hugs <3
...wer to how things > > should be interpreted here. > > Ugh, was not aware that there two documents. > > Yeah, definitely sheds light. Why the documents could not be merged > to single common sense code of conduct? The fact that we've arrived at essentially an original CoC reinterpreted to the point where it's effectively a new CoC has been the source of much debate and recrimination over the last few months ... you can read it in the ksummit-discuss archives, but I really think we don't want to reopen that can of worms. James
2013 Dec 11
2
[LLVMdev] Switching to the new MingW ABI
...unary/expr.unary.op/p4.cpp > Clang :: CXX/temp/temp.arg/temp.arg.nontype/p5.cpp > Clang :: SemaCXX/addr-of-overloaded-function.cpp > Clang :: SemaCXX/const-cast.cpp > Clang :: SemaCXX/cstyle-cast.cpp > Clang :: SemaCXX/functional-cast.cpp > Clang :: SemaCXX/reinterpret-cast.cpp > Clang :: SemaCXX/static-cast.cpp > Printing thiscall attribute on member function pointer type. > > Clang :: CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp > Clang :: SemaTemplate/explicit-instantiation.cpp > Clang :: SemaTemplate/instantiate-method.cpp >...
2011 Sep 22
0
[LLVMdev] Need help in converting int to double
...i8** %4 = load i8** %3; i8* %5 = bitcast i8* %4 to i64* %6 = load i64* %2 %7 = load i64* %5 Then you call convertDoubleToInt64(). What does this actually do? It's in trouble by this point because it needs to do a fptosi on a double operand, but you've got an i64 operand and you can't reinterpret-cast ints to floats in LLVM IR (AFAIK) I can't see what your code is doing afterwards as it uses calls to helper functions that you haven't included. The main point I'd raise is: if your value is stored as a double inside the Value structure, then why are you bitcasting to i64*? Why n...
2011 Sep 23
0
[LLVMdev] Need help in converting int to double
...y Cc: sarath chandra; llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Need help in converting int to double On Sep 22, 2011, at 3:32 AM, James Molloy wrote: > It's in trouble by this point because it needs to do a fptosi on a double operand, but you've got an i64 operand and you can't reinterpret-cast ints to floats in LLVM IR (AFAIK) You can bitcast ints to floats and vice-versa if they're the same size - for example, i32 to float and i64 to double. John. -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not...
2011 Sep 22
2
[LLVMdev] Need help in converting int to double
...;> %4 = fptosi double %2 to i64 >> >> %5 = shr i64 %3, %4 ; Perform your operation. >> >> %6 = sitofp i64 %5 to double ; Convert explicitly back to integer >> representation. >> >> %7 = store bitcast i8* %dest to double*, double %6 ; Store back, >> reinterpreting your void* (which is i8* in LLVM) as a double*. >> >> >> Hopefully this makes sense, especially if you know how you would have to >> do it in C. >> >> Cheers, >> >> James >> >> From: sarath chandra [mailto:sarathcse19 at gmail.com] >...
2013 Dec 11
0
[LLVMdev] Switching to the new MingW ABI
...pp Clang :: CXX/expr/expr.unary/expr.unary.op/p4.cpp Clang :: CXX/temp/temp.arg/temp.arg.nontype/p5.cpp Clang :: SemaCXX/addr-of-overloaded-function.cpp Clang :: SemaCXX/const-cast.cpp Clang :: SemaCXX/cstyle-cast.cpp Clang :: SemaCXX/functional-cast.cpp Clang :: SemaCXX/reinterpret-cast.cpp Clang :: SemaCXX/static-cast.cpp Printing thiscall attribute on member function pointer type. Clang :: CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp Clang :: SemaTemplate/explicit-instantiation.cpp Clang :: SemaTemplate/instantiate-method.cpp Clang :: SemaTemplate/temp_arg...
2011 Sep 23
1
[LLVMdev] Need help in converting int to double
...ra; llvmdev at cs.uiuc.edu > Subject: Re: [LLVMdev] Need help in converting int to double > > On Sep 22, 2011, at 3:32 AM, James Molloy wrote: >> It's in trouble by this point because it needs to do a fptosi on a double operand, but you've got an i64 operand and you can't reinterpret-cast ints to floats in LLVM IR (AFAIK) > > You can bitcast ints to floats and vice-versa if they're the same size - for example, i32 to float and i64 to double. > > John. > > > -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also...
2009 Jul 20
0
[LLVMdev] PIC16TargetAsmInfo::getBSSSectionForGlobal
...gt; Sent: Monday, July 20, 2009 3:21 PM > To: Sanjiv Kumar Gupta - I00171 > Cc: LLVM Developers Mailing List > Subject: [LLVMdev] PIC16TargetAsmInfo::getBSSSectionForGlobal > > > Hi Sanjiv, > > The PIC16TargetAsmInfo::getBSSSectionForGlobal apparently does magic > that reinterprets the "section" field of a global in a strange way: > > // If GV has a sectin name or section address create that section > now. > if (GV->hasSection()) { > std::string SectName = GV->getSection(); > // If address for a variable is specified, get th...
2013 Oct 29
0
[LLVMdev] Missed optimization opportunity with piecewise load shift-or'd together?
...e used based on target platform and its > > endedness. > > One reason for writing code like this, i.e. explicitly spelling out > the accesses to the individual bytes, would be to allow compile-time > evaluation of the fragment in the D programming language, where > arbitrarily reinterpreting memory is not supported (although > integer->integer pointer casts might be supported at some point). > > Would a patch adding the capability to lower this to InstCombine or > similar have a chance of being accepted, or would that be considered > to be too rare a spacial case...
2013 Aug 08
5
[LLVMdev] Address space extension
On 08/08/2013 02:16 PM, Justin Holewinski wrote: > Why should SelectionDAGBuilder generate an explicit bitcast for a no-op > bitcast? The bitcast operation isn't just the reinterpretation (change in the semantic) of the bits without any change in the value of the bits itself? If the size and value do not change should be fine. > By definition, no bits are changed; so if the EVTs match, > there is nothing to do. The fundamental problem is how address spaces > are ha...
2018 Aug 14
1
GCC 5 and -Wstrict-aliasing in JSON.h
...a template producing a char array suitably aligned for any number > of mutually exclusive types, much like > https://en.cppreference.com/w/cpp/types/aligned_union. > > I can't tell if that makes the waters less dangerous, but there's an > invariant for this code that it only reinterpret_casts out Ts from the > char buffer that it has previously put in there using placement new. > As far as I can tell, that should be safe. The local construct in the > as<T>() member function template, something like 'return > *reinterpret<T *>(buffer);' is generally...